Book Image

Application Development with Swift

By : Hossam Ghareeb
Book Image

Application Development with Swift

By: Hossam Ghareeb

Overview of this book

Table of Contents (14 chapters)

Introduction to Swift

Swift is a new (Apple has open sourced it!), scripting, programming language for developing apps for iOS, OS X, and watchOS. Apple has introduced this language to make things easier and fun. Unlike Objective-C, Swift is not a superset of C programming language. But believe me, it has the power of both C and Objective-C.

It's the first time we have an alternative to Objective-C, since Apple introduced iOS and OSX development tools. As a new programming language, Swift introduces many new features and concepts that did not exist in Objective-C, and we will talk about them in next sections. For Objective-C developers, Swift will be familiar to them, as it adopts the readability of Objective-C's named parameters. Swift is a friendly programming language. It is so expressive and funny even for new programmers who have no experience with Objective-C.

Like Objective-C, Swift is an OOP language and you can easily create classes, objects, methods, and properties. Swift is built to make developers write safe code, and you will feel this when you will start working with it. An example of this is that you can't use variables without initialization. Swift saves you from making silly errors that you could make, such as using variables before initialization.

Don't hesitate to work with Swift, and give it a shot. Swift co-exists alongside your existing Objective-C code, and is easy to work with. You can also replace your existing Objective-C code with Swift, or start your project from scratch with Swift as your primary development language.

Make sure that you are familiar with Swift features to feel its power, and enjoy it. Some of these features are new for Objective-C developers, and these will let you love Swift, as I do:

  • Closures

  • Tuples

  • Range operators

  • Generics

  • Structures

  • Functional programming patterns