INTRODUCTION TO SWIFT
- Amruta Bhaskar
- Jan 3, 2020
- 0 Bemerkungen)
- 1011 Ansichten
SWIFT is all-purpose and compiled programming language developed by APPLE Inc. for iOS, macOS, watchOS, Linux. It is designed to work with Apple’s Cocoa and the large body of existing Objective-C has written for all Apple’s products.
Swift uses the Objective-C runtime library which (that) allows C, C++, Objective-C and also the swift code to run within one program. Apple proposed swift to support core concepts that are associated with Objective-C, extensible programming is making it easier to grab software bugs. It has features addressing some of the common programming errors like null pointer dereferencing, It provides syntactic sugar to avoid the pyramid of doom. Swift also supports the concept of protocol extensibility. An Extensibility system can be applied to types, (of) structs and classes such that Apple advances as a real change in programming criterion by terming “PROTOCOL-ORIENTED PROGRAMMING”
At Apple’s 2014 Worldwide Developers Conference (WWDC), Swift was introduced. During 2014 it underwent an upgrade to version 1.2 and in 2015, there was a major upgrade to Swift 2 at WWDC. It was a proprietary language, later version 2.2 was made an open-source software supported by Apache License 2.0 on December 3 2015, for Apple’s platforms and Linux.
The syntax of Swift encountered significant evolution through version 3.0 and in the first quarter of 2018 it was better than Objective-C in popularity.
In the year 2017 Swift 4.0 was released, introducing to several changes to some built-in classes and structures. Code that was written in previous versions could be updated using the migration functionality that built into Xcode. Later In March 2019, Swift 5 was released introducing a stable binary interface on all Apple platforms, allowing swift runtime that is to be included in Apple OS. In September 2019 Swift 5.1 was officially released by extending the stable features of the language to compile-time with the introduction of module stability that makes it possible to create and share frameworks that will work with future releases of swift.
FEATURES OF SWIFT
· Closure support: It supports closures known as lambdas in other languages.
· String support: It includes NSString string library, NSArray and NSDictionary.
· Access control: It supports 5 access control levels for symbols: open, public, internal, fileprivate and private.
· Optionals and chaining: It is an important feature in Swift, it allows values to operate in a manner that is similar to the common pattern in C, where a pointer refers to a value or null, implies that non-optional types cannot result in a null pointer error. Optionals types are created with the mechanism called optional by making an integer that is nullable.
var optionalInteger: Optional is the declaration.
You can also use a question mark instead of optional var optionalInteger: Int? that (which) indicates a variable.
nil can be used for the variables or constants that are marked optional.
· Protocol-oriented programming: It supports categories, methods that are added to extend class runtime.
· Swift uses the same runtime as the actual Objective-C.
· It uses Automatic Reference Counting to manage memory.
· Has the ability to be cleanly debugged and run within the development environment.
· It is similar to C in many ways and Objective-C.
Author: Vindhya A S