ABSTRACT

Swift is an innovative, open source language developed by Apple to make software safer, faster, and more fun to create. It is a powerful, general purpose systems language that feels like a scripting language. This chapter focuses on the features of Swift that make it a safe language, such as guaranteed memory initialization, static typing, overflow checking, and excellent syntactic support for optionals. It examines external parameter names, for one, and focuses on the role of protocols and extensions in the type system. The chapter then explores automatic reference counting. A protocol specifies certain requirements that structures, enumerations and classes that wish to adopt the protocol must conform to. The protocol definition itself defines a number of requirements for not only properties but initializers and functions as well. The Swift standard library defines over 100 structures, enums, and classes, and several dozen protocols.