Skip to main content

Posts

Using Swift with Objective-C and Cocoa

Swift gain so much popularity in very short duration and people are really very excited to develop the application in swift. So, the number of application in swift is increasing exponentially. However, there are vast numbers of legacy applications which are built using objective-c and now in the process of migration or mixture (Objective-C & Swift). Today, I will explain how to integrate swift in the existing Objective-c application and vice versa. Let suppose you are working on an application written totally in objective-c and now you want to implement all the new feature in swift then you can follow the following steps to use both the languages in a single application: Access Swift Class into Objective-C 1) Add a new swift file in your application by selecting File ->  New->File. Then select a swift file as an   option. 2) As you click on "Create", a dialogue box will appear which give you an option to create   a bridging Header. Make sure to select “ C
Recent posts

Moving from Objective-C To Swift!!!

Swift is a new programming language introduced by apple in WWDC-2014. It is one of the fastest adapted programming language. When apple launch the language I have some question in my mind: 1) What is the need of new programming language? 2) What is wrong with the old one (Objective-c) ? 3) Objective-C will be obsolete? When i reached office next day and discussed about the new language. They are very happy as they found syntax very similar to other language. Now they can easily relate syntax and concept of swift with the other modern languages and quickly learn iOS development. Apple introduced the new language with following tagline 1) Safe 2) Modern 3) Powerful Let have look on the feature of swift: Variable & Properties in Swift: In Objective-C properties and ivar are two different entity. You need to declare a property seperately to access ivar from outside of class. //ViewController.h @interface ViewController : UIViewController { N