If you are still stuck with objective-c, please read this article. In 2014 Apple released a new programming language called Swift, You might have a question in your mind why apple introduced a new programming language, even objective-c was fulfilling all requirements of developers.
There are many reasons like
- Objective C is an old age programming language in terms of architecture and frameworks built in it.
- Objective C was designed and developed for developing MAC OS applications, Not for new generation hardware like iPhone, iPad, Apple Watch, Swift is designed to keep those devices on priority also.
- Syntactically and development perspective Objective is hard, For example, Objective-C using the pointer to addressing data.
Swift supports dot (.) oriented syntax, Swift syntax is easy to read-write. Not having square brackets like objective-c.
Open-Source programming language:
As we know swift is an open-source programming language, Apple allows others to push code changes in the master repository of swift after verifying. This means you found anything which could be a more feasible and productive solution than default one. you can suggest those changes/features.
Thats why swift syntax are changing constantly in every version, and swift become easy as pie and flexible in there own way.
Rid of from diffrent declaration and implementation class
No separate class for outlets, property, and object declaration, like no more .h and .m classes for each individual viewController and other cocoa-touch classes.
If you want to create an object of any class in objective-c, you have to import this class in derived class but now in swift don’t need to import any class. you can directly access any clas from the bundle and create an object of it without importing this class.
if you created a completion handler or block in Objective-C, you know how much disincentive to write such syntax, but in swift, those code syntax is written understandable, and easy to write, For example.
Dispatch main queue in objective c :
// do work here
Dispatch main queue in Swift :
// your code
Optional chaining :
Swift allows initialize the object with optional or non-optional type, This Means object could set nil, throughout the lifecycle of this object, optional chaining and optional binding allows us to handle memory leak-related issues.