© Wallace Wang 2017

Wallace Wang, macOS Programming for Absolute Beginners, 10.1007/978-1-4842-2662-9_13

13. Creating Classes and Objects

Wallace Wang

(1)San Diego, California, USA

The heart of programming in Swift using Xcode is object-oriented programming. The main idea is to divide a large program into separate objects where each object ideally represents a physical entity. For example, if you are creating a program to control a car, one object may represent the car’s engine, a second object may represent the car’s entertainment system, and a third object may represent the car’s heating and cooling system.

Now if you want to update the part of a program that controls the car’s engine, you just have to modify or replace the object that controls ...

Get macOS Programming for Absolute Beginners: Developing Apps Using Swift and Xcode now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.