Classes, Structures, and Enumerations

At this point, you can write fairly sophisticated programs that use conditionals to determine which path to take and loops to repeat sequences over and over. You've learned how to group instruction sequences together using functions and pass bits of code around using closures.

It's time to think about how to represent complex objects in your code. For example, think about a car. You could use a string constant to store a car name and a double variable to store a car price, but these constants or variables are not associated with one another.

You've seen that you can group instructions together to make functions and closures. Can you group constants and variables together in a single entity? Indeed, you ...

Get iOS 13 Programming for Beginners - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.