O'Reilly logo

Objective-C Memory Management Essentials by Gibson Tang, Maxim Vasilkov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basics of Swift

Swift syntax is very different to Objective-C, while Objective-C has a lot of reliance on C and C++ components such as pointers, strong typing, and so on. Swift is very similar to popular scripting languages such as Python and Ruby with regards to terseness and variable declaration. So, let's look at some basics of Swift to get acquainted with it.

Variable declaration

Swift does away with the need to remember ints, floats, NSStrings, and so on and consolidates all of these type of variables under one type, and that is of the type var. If you are familiar with JavaScript, then the var keyword should not be unfamiliar to you. Swift supports the type inference, where depending on the value that you assign to a variable, it will infer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required