O'Reilly logo

iOS 9 SDK Development by Janie Clayton, Chris Adamson

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

Building Lightweight Structures

If we want to get away from object-oriented programming and try something different, we have to free ourselves of classes. In the next few sections, we’ll do just that, and see that we’re not losing anything in the transition.

To make a clean start, close this playground and create a new playground called StructsPlayground.

Let’s think about the IOSDevice that we created as a class: it had some simple properties for the device name and dimensions, and some methods that operated on those properties. If it mostly serves as a container for data, if we don’t care about inheritance, and if the data is small and not difficult to copy around in memory, then it’s the kind of thing that functional programmers would tell ...

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