How to call Objective C viewcontroller in SwiftHow do I call Objective-C code from Swift?How do I sort an NSMutableArray with custom objects in it?How can I make a UITextField move up when the keyboard is present - on starting to edit?How do I check if a string contains another string in Objective-C?How do I call Objective-C code from Swift?#pragma mark in Swift?How can I extend typed Arrays in Swift?Instantiate and Present a viewController in SwiftPassing an object from one viewcontroller to another viewcontroller got nil in swiftset initial viewcontroller in appdelegate - swiftSwift setting object to nil does not release memory

Too many SOQL Queries when inserting records

Does immunity to damage from nonmagical attacks negate a rogue's Sneak Attack damage?

Main differences between 5th edition Druid and 3.5 edition Druid

What did Boris Johnson mean when he said "extra 34 billion going into the NHS"

Why didn't Thatcher give Hong Kong to Taiwan?

How can I oppose my advisor granting gift authorship to a collaborator?

Is it possible to observe space debris with Binoculars?

Adding transparency to ink drawing

Were the women of Travancore, India, taxed for covering their breasts by breast size?

If p-value is exactly 1 (1.0000000), what are the confidence interval limits?

Case Studies and Real Problems for Teaching Optimization and Modelling

What is the most likely cause of short, quick, and useless reviews?

What happens when there is no available physical memory left for SQL Server?

Should I use pigtails for pass-through split outlet connections?

Is it safe for a student to give negative feedback in student evaluations?

Why did the Joi advertisement trigger K?

How could it be that the capo isn't changing the pitch?

What is this red bug infesting some trees in southern Germany?

Travel to USA with a stuffed puppet

Running a script inside another script

Are there photos of the Apollo LM showing disturbed lunar soil resulting from descent engine exhaust?

How does Harry wear the invisibility cloak?

Does secure hashing imply secure symmetric encryption?

If I have an accident, should I file a claim with my car insurance company?



How to call Objective C viewcontroller in Swift


How do I call Objective-C code from Swift?How do I sort an NSMutableArray with custom objects in it?How can I make a UITextField move up when the keyboard is present - on starting to edit?How do I check if a string contains another string in Objective-C?How do I call Objective-C code from Swift?#pragma mark in Swift?How can I extend typed Arrays in Swift?Instantiate and Present a viewController in SwiftPassing an object from one viewcontroller to another viewcontroller got nil in swiftset initial viewcontroller in appdelegate - swiftSwift setting object to nil does not release memory






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I found a ViewController SDK using objective C. I want to use it swift but fail to call.



Can you suggest me any idea for using it?



I want to create a storyboard and set the custom class in ViewControllerObjectiveC, but still fail to open the viewcontroller.



let vc = sb.instantiateViewController(withIdentifier: "ViewControllerObjectiveC") as! ViewControllerObjectiveC
self.dismiss(animated: false, completion: nil)
self.presentingViewController?.present(vc, animated: false, completion: nil)









share|improve this question





















  • 7





    Possible duplicate of How to call Objective-C code from Swift

    – El Tomato
    Mar 28 at 2:53











  • Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

    – Pranay
    Mar 28 at 5:23


















0















I found a ViewController SDK using objective C. I want to use it swift but fail to call.



Can you suggest me any idea for using it?



I want to create a storyboard and set the custom class in ViewControllerObjectiveC, but still fail to open the viewcontroller.



let vc = sb.instantiateViewController(withIdentifier: "ViewControllerObjectiveC") as! ViewControllerObjectiveC
self.dismiss(animated: false, completion: nil)
self.presentingViewController?.present(vc, animated: false, completion: nil)









share|improve this question





















  • 7





    Possible duplicate of How to call Objective-C code from Swift

    – El Tomato
    Mar 28 at 2:53











  • Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

    – Pranay
    Mar 28 at 5:23














0












0








0








I found a ViewController SDK using objective C. I want to use it swift but fail to call.



Can you suggest me any idea for using it?



I want to create a storyboard and set the custom class in ViewControllerObjectiveC, but still fail to open the viewcontroller.



let vc = sb.instantiateViewController(withIdentifier: "ViewControllerObjectiveC") as! ViewControllerObjectiveC
self.dismiss(animated: false, completion: nil)
self.presentingViewController?.present(vc, animated: false, completion: nil)









share|improve this question
















I found a ViewController SDK using objective C. I want to use it swift but fail to call.



Can you suggest me any idea for using it?



I want to create a storyboard and set the custom class in ViewControllerObjectiveC, but still fail to open the viewcontroller.



let vc = sb.instantiateViewController(withIdentifier: "ViewControllerObjectiveC") as! ViewControllerObjectiveC
self.dismiss(animated: false, completion: nil)
self.presentingViewController?.present(vc, animated: false, completion: nil)






ios objective-c swift






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 5:37









Revanth Kausikan

4851 gold badge4 silver badges13 bronze badges




4851 gold badge4 silver badges13 bronze badges










asked Mar 28 at 2:46









ebank dsbebank dsb

1




1










  • 7





    Possible duplicate of How to call Objective-C code from Swift

    – El Tomato
    Mar 28 at 2:53











  • Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

    – Pranay
    Mar 28 at 5:23













  • 7





    Possible duplicate of How to call Objective-C code from Swift

    – El Tomato
    Mar 28 at 2:53











  • Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

    – Pranay
    Mar 28 at 5:23








7




7





Possible duplicate of How to call Objective-C code from Swift

– El Tomato
Mar 28 at 2:53





Possible duplicate of How to call Objective-C code from Swift

– El Tomato
Mar 28 at 2:53













Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

– Pranay
Mar 28 at 5:23






Try to change last two lines as => self.dismiss(animated: true) self.presentingViewController?.present(vc, animated: true, completion: nil)

– Pranay
Mar 28 at 5:23













2 Answers
2






active

oldest

votes


















0
















In order to interact Obj-C code with Swift you will need to have a bridging header file. The name of the bridging header MUST be like <YourProject>-Bridging-Header.h. While you can create it manually there is an option which the Xcode creates it yourself. For the second option create a new file with .m extension. The Xcode will ask you to create a bridging header. Approve it.



Now import everything in this file you need to reach from Swift. In your case put the following inside your bridging header:



#import "ViewControllerObjectiveC.h"


Assuming your Obj-C file has the name ViewControllerObjectiveC.h. The code you shared should work now.






share|improve this answer
































    0
















    Bridging Header is the way to solve your problem.



    See this Apple Document:



    https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift



    Step 1
    Drag and drop your Objective-C files into the project after that you will see this message inside your Xcode project.



    See this popup



    Then click on Create Bridging header option. It will create one header file inside your project.



    Confirm Header File



    Now you just have to Import your Objective C File into created header file.



    That's It.






    share|improve this answer

























    • @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

      – Darshan Kunjadiya
      Apr 9 at 6:00













    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389445%2fhow-to-call-objective-c-viewcontroller-in-swift%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0
















    In order to interact Obj-C code with Swift you will need to have a bridging header file. The name of the bridging header MUST be like <YourProject>-Bridging-Header.h. While you can create it manually there is an option which the Xcode creates it yourself. For the second option create a new file with .m extension. The Xcode will ask you to create a bridging header. Approve it.



    Now import everything in this file you need to reach from Swift. In your case put the following inside your bridging header:



    #import "ViewControllerObjectiveC.h"


    Assuming your Obj-C file has the name ViewControllerObjectiveC.h. The code you shared should work now.






    share|improve this answer





























      0
















      In order to interact Obj-C code with Swift you will need to have a bridging header file. The name of the bridging header MUST be like <YourProject>-Bridging-Header.h. While you can create it manually there is an option which the Xcode creates it yourself. For the second option create a new file with .m extension. The Xcode will ask you to create a bridging header. Approve it.



      Now import everything in this file you need to reach from Swift. In your case put the following inside your bridging header:



      #import "ViewControllerObjectiveC.h"


      Assuming your Obj-C file has the name ViewControllerObjectiveC.h. The code you shared should work now.






      share|improve this answer



























        0














        0










        0









        In order to interact Obj-C code with Swift you will need to have a bridging header file. The name of the bridging header MUST be like <YourProject>-Bridging-Header.h. While you can create it manually there is an option which the Xcode creates it yourself. For the second option create a new file with .m extension. The Xcode will ask you to create a bridging header. Approve it.



        Now import everything in this file you need to reach from Swift. In your case put the following inside your bridging header:



        #import "ViewControllerObjectiveC.h"


        Assuming your Obj-C file has the name ViewControllerObjectiveC.h. The code you shared should work now.






        share|improve this answer













        In order to interact Obj-C code with Swift you will need to have a bridging header file. The name of the bridging header MUST be like <YourProject>-Bridging-Header.h. While you can create it manually there is an option which the Xcode creates it yourself. For the second option create a new file with .m extension. The Xcode will ask you to create a bridging header. Approve it.



        Now import everything in this file you need to reach from Swift. In your case put the following inside your bridging header:



        #import "ViewControllerObjectiveC.h"


        Assuming your Obj-C file has the name ViewControllerObjectiveC.h. The code you shared should work now.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 6:27









        Onur TunaOnur Tuna

        6526 silver badges22 bronze badges




        6526 silver badges22 bronze badges


























            0
















            Bridging Header is the way to solve your problem.



            See this Apple Document:



            https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift



            Step 1
            Drag and drop your Objective-C files into the project after that you will see this message inside your Xcode project.



            See this popup



            Then click on Create Bridging header option. It will create one header file inside your project.



            Confirm Header File



            Now you just have to Import your Objective C File into created header file.



            That's It.






            share|improve this answer

























            • @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

              – Darshan Kunjadiya
              Apr 9 at 6:00















            0
















            Bridging Header is the way to solve your problem.



            See this Apple Document:



            https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift



            Step 1
            Drag and drop your Objective-C files into the project after that you will see this message inside your Xcode project.



            See this popup



            Then click on Create Bridging header option. It will create one header file inside your project.



            Confirm Header File



            Now you just have to Import your Objective C File into created header file.



            That's It.






            share|improve this answer

























            • @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

              – Darshan Kunjadiya
              Apr 9 at 6:00













            0














            0










            0









            Bridging Header is the way to solve your problem.



            See this Apple Document:



            https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift



            Step 1
            Drag and drop your Objective-C files into the project after that you will see this message inside your Xcode project.



            See this popup



            Then click on Create Bridging header option. It will create one header file inside your project.



            Confirm Header File



            Now you just have to Import your Objective C File into created header file.



            That's It.






            share|improve this answer













            Bridging Header is the way to solve your problem.



            See this Apple Document:



            https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/importing_objective-c_into_swift



            Step 1
            Drag and drop your Objective-C files into the project after that you will see this message inside your Xcode project.



            See this popup



            Then click on Create Bridging header option. It will create one header file inside your project.



            Confirm Header File



            Now you just have to Import your Objective C File into created header file.



            That's It.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 8 at 10:55









            Darshan KunjadiyaDarshan Kunjadiya

            5611 silver badge9 bronze badges




            5611 silver badge9 bronze badges















            • @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

              – Darshan Kunjadiya
              Apr 9 at 6:00

















            • @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

              – Darshan Kunjadiya
              Apr 9 at 6:00
















            @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

            – Darshan Kunjadiya
            Apr 9 at 6:00





            @ebank dsb Can you please look into this answer and do let me know if you required more information. Thanks

            – Darshan Kunjadiya
            Apr 9 at 6:00

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55389445%2fhow-to-call-objective-c-viewcontroller-in-swift%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해