Rss Feed
    Showing posts with label Objective-C. Show all posts
    Showing posts with label Objective-C. Show all posts
  1. Steps for using Swift Class in Objective C iOS project

    • Drag and drop our Swift file to our project. Make sure to prefix you're Swift class with @ObjC as shown in image below.


    • You will be asked if a "Bridging-header" file should be added to the  project as shown below. Select "Create Bridging Header"


    • Assuming a project name "MyProject", this will create a file named "MyProject-Bridging-Header.h". This file is important to achieve what we are looking for even though we will not be adding anything to this file.
    • Open Build Settings and configure some of the below mentioned values
      • Defines Module - YES
      • Embedded Content Contains Swift - YES
      • Install Objective-C Compatibility Header - YES 
    • Now that you are in Build Settings screen, just search for "Swift Compiler", notice an entry is created for "Objective-C Generated interface Header Name" which will be a *-Swift.h file. 


    • You will need to import this file in your Objective-C header file that where you would want the Swift class to be available. In my case it will be "MyProject-Swift.h". 
    • After importing, you're Swift class should be accessible from the Objective-C file, if it still isn't, then just try some below trouble shooting methods. Sometimes the Swift Interface file will not be generated.
      • Do a Clean Build and Run your code
      • Delete Derived Data and repeat previous step.



  2. Intro post

    Saturday, June 7, 2014

    So.. Big day June 2nd at WWDC14! Swift Language is going to replace Objective-C in iOS and Mac Development here after. None of the rumor makers saw that coming.. did they?

    Personally I am very excited about this. I had been with Objective-C for past 3 years and I don't like the thought of it fading off, but I believe is change is good! I'm hoping this change is going to make it better for us developer's.

    Initial look at the language shows some of the things made simpler and some complex. What I liked is that now the updated syntax brings it closer to scripting languages out there (Now many of the web developers have the opportunity to flock into iOS and Mac Development). Some of the syntax's have been made simpler and some complex (very complex!). Its definitely going to take some time for it to settle in.

    I had been writing blog posts from sometime now; some tech posts, some of open source softwares and photography. I always wanted to get into geek mode start writing programming posts. I think this is the right time for that. I hoping to post some interesting stuff on iOS Development that I come across in my professional life.

    Thanks you.
    Cheers