CUSTOM CLASSES AND STRUCTS
Up to this point, the variables and constants you’ve been using were simple Int, Double, and String data types. You’ve also learned how to work with collections of data like arrays and dictionaries. In this chapter, you’ll learn how to create your own type of data by writing a custom class that can be anything you want!
A class is a package that contains different types of data and functions that use that data. A custom class is a new data type that you can use to create objects. In the real world, an object is something that can be seen and touched, like a backpack, a cat, or a car. In Swift, objects can either represent ...