Cocoa Programming for OS X: The Big Nerd Ranch Guide
by Aaron Hillegass, Adam Preble, Nate Chandler
Types in Swift
Swift types can be arranged into three basic groups: structures, classes, and enumerations. There are other types that fall outside of these three, such as closures, but these are the building blocks of Swift. All three can have
-
properties: values associated with a type
-
initializers: similar to a function, code that initializes an instance of a type
-
instance methods: functions specific to a type that can be called on an instance of that type
-
class or static methods: functions specific to a type that can be called on the type itself
Figure 2.1 Swift building blocks
Swift’s structures and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access