Objective-C is the primary programming language used to develop Mac OS X and iOS applications for the past decades. However, earlier this June, Apple released its new programming language called Swift.
Apple described that writing code with Swift is interactive and fun, the syntax is concise yet expressive, and apps run lightning-fast; Swift code works side-by-side with Objective-C thus ready to use for your next iOS and OS X project – or for addition into your current app.
The following are some of Swift language’s best features:
Modern Programming Language
- Swift is the result of research on programming languages that takes the best features of C and Object-C, removing the restrictions on C compatibility.
- APIs are easy to read and maintain.
- Cleaner codes.
- Managed memory automatically using Automatic Reference Counting (ARC).
- Typing semi-colons is no longer needed.
- Ideal for new programmers as it uses Playgrounds that show results immediately after typing a line of code which makes writing simple and fun.
- Adopts the readability of Objective-C’s named parameters and the power of Objective-C’s dynamic object model.
- Offer easy access to existing Cocoa frameworks.
- A built-in interactive version of Swift language is included in Xcode’s debugging console or in Terminal. To evaluate and interact with a running app or see how a newly written code works in a script-like environment, use Swift syntax.
- Removes all classes of unsafe code.
- Always initialized variables before use.
- Checks arrays and integers for overflow.
- Safe patterns in Swift are adjusted for the Cocoa and Cocoa Touch APIs.
Fast and Powerful
- Uses high-performance LLVM compiler that transforms Swift code into optimized native code.
- Improved syntax and standard library.
- Includes low-level primitives such as types, flow control, and operators.
- Offer object-oriented features such as classes, protocols, and generics suitable for Cocoa and Cocoa Touch.
Developers can now start using Swift code to add new features or improve existing applications. They can also submit Swift-written apps to App Store and Mac App Store once iOS 8 and OS X Yosemite are released.