7 Things to know about Swift Programming

Swift is the new programming language for Apple developers which was launched early 2014. According to Apple, developing app’s will be more easy and fun using Swift.

Below are the 7 things you should know about Swift :

1. Swift is faster – Swift is far more better that Objective as it’s supposed to provide extreme performance. In addition it runs on the same LLVM compiler so you can work with the Objective C code in the same project, which provides a complete adoption.

2. PlayGround –  Swift comes with an advanced feature called ‘Playground’. The playground is definitely a great tool to use. You can see your results instantly appearing for every line. This is ultimately helpful to check how your code logic, algorithms and debugging works.

3. De-initialization – A de-initializer is called immediately before a class instance is de-allocated. You write de-initializaters with the reinit keyword, similar to how initializers are written with init keyword. De-initializaers are only available on class types.

deinit {
// perform the reinitialization

4. Generics – Generics is the most powerful feature of Swift. Generic code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements you define. You can write code that avoids duplication and expresses its intent in a clear, abstracted manner.

For Example Array and Dictionary types are both generic collections.

5. Advanced Operators – In addition to basic operators, Swift provides several advanced operators that perform more complex value manipulation. These includes all of the bitwise and bit shifting operators. Example Overflow addition operator (&+). All overflow operator begins with ampersand (&).

6. Optional Chaining – Optional chaining is a progress for querying and calling properties, methods, and subscripts on an optional that might currently be nil. You specify optional chaining by placing a question mark (?) after the optional value on which you wish to call a property, method or subscript if the optional is non-nil.

class Company {
var address: Address?

7. Basics – Header files are not required. Statements do not need to end with a semicolon (‘;’), though they must be used to allow more than one statement on a line. Variables and constants are always initialized and array bounds are always checked.

Comments are closed.