Swift is programming language from the Apple company, which is intended for the development on platforms MacOS and iOS. It is multi-paradigm, compiled and open source. It was supposed to be an alternative for the Objective-C language, in contrast to it, it shouldn’t allow so many mistakes of programmer. It can cooperate with existing frameworks Cocoa Touch and Cocoa. It is compiled with the help of LLVM and in this program it is possible to combine it with languages with C, Objective-C and Objective-C++.

Objective-C

Objective-C is often called ObjC and it is object-oriented programming language, which is implemented as expansion of language C. In this was added system of sending messages from Smalltalk language. It is used for operating systems Mac OS X, iOS and GNU project GNUstep. The environment is based on OpenStep standard.

History

Chris Lattner started the development of Swift in 2010. Gradually the other developers joined in. Development of Swift has inspired by languages from Objective-C to Rust, Haskell, Python, C#, CLU and by many others.

Swift was published on world conference of Apple WWDC developers on 2nd June 2014 including documentation, which is available on Apple developer’s pages and in iBooks store. On conference was introduced beta version of programming language to registered Apple developers, but the company did not promise final version of Swift, which would be, in terms of source code, compatible with this beta version. Apple planned to disclose convertors of source code, if it was necessary for the full release.

Five pages long, The Swift Programming Language manual, was published on the conference.

Swift has reached a major milestone on 9th September 2014 with Gold Master Xcode 6.0 for iOS. Swift 1.1 was published on 22nd October 2014 together with executing the Xcode 6.1. Swift 1.2 was published on 8th April 2015 together with Xcode 6.3. Swift 2.0 was subsequently announced on WWDC conference in 2015 and was disclosed for publishing apps in App Store on 21st September 2015. Swift 3.0 was then published on 13th September 2016. Swift 4.0 was published a year later on 19th September 2017. Swift 4.1 was then published after half a year on 29th March 2018.

Swift has won the first place in Most Loved Programming Language survey among developers on Stack Overflow in 2015 and then the second place in the same survey a year later.

IBM activated its websites, Swift Sandbox, in December 2015, which allow for developers to write code in Swift on one side of the screen and display the output immediately on the other side.

During the conference WWDC 2016, Apple announced, that it will publish exclusive app on iPad, which will be named Swift Playgrounds and its target will be to learn programmers how to work in Swift. App was introduced in interface, that resembles 3D videogames, where the feedback is displayed, if the lines of the code are entered in given order and executed.

In January 2017, Chris Lattner reported leaving Apple for a new position in Tesla Motors, and he passed on his position, leading developer of Swift, to the team veteran Ted Kremenek.

Specifics of Swift

Swift, to large extent, uses as its base the Objective-C language, which it modernizes with new concepts and syntax. During its original presentation, it was reported as “Objective-C without the C”, because Swift does not use pointers in comparison to Objective-C. Although, pointers are still possible to use in case of need.

Another difference is replacing Smalltalk way of calling the method by the dot notation and namespaces. That is common in other languages similar to C, e. g. Java or C#. Swift, against the Objective-C, brings newly names parameters, while preserving the key features of Objective-C, by which is often the simplification of syntax successful in Swift.

Types and variables in Swift

Cocoa Touch and Cocoa contain many classes, which belonged to the Foundation Kit library. Among which belongs e. g. NSString, which servers for work with Unicode string or NSArray and NSDictionary collection. With the help of the syntactic sugar, Objective-C enables simple creation of these objects, but then, when they are created, it is necessary to manipulate with them using the calling of object method. There is an option to directly manipulate with many of these basic types in Swift and they are part of language. E. g. strings are on NSString, if the Foundation is imported, invisibly mapped.

Foundation Kit contains two versions for most of the classes, variable, which can be, while the program is running, modified to invariable, which can be only read during the running of a program.

Other Swift features

Swift can be executed on multiple existing platforms. One program can simultaneously be programmed in Swift, Objective-C and C or C++. Within simplifying the app development, Xcode offers semi-automatic system, which helps with creation and administration of bridging files, which disclose Objective-C code for Swift.