O'Reilly logo

Swift Translation Guide for Objective-C Users: Develop and Design by Maurice Kelly

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

Chapter 13. Protocols, Extensions, and Generics

Protocols should be a familiar sight to any Objective-C developer. They are used throughout the Apple frameworks to define behaviors (in the form of properties and methods) that classes should conform to. Although extensions may sound new, they already exist in Objective-C as categories and can be used to provide extra functionality to existing classes. Swift protocols and extensions differ from their Objective-C counterparts in that they can be used with structures and enumerations as well as classes.

Generics are a completely new technology introduced by Swift. Their purpose is to allow a function or a type to be created in such a way that the type it acts upon does not need to be specified at ...

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