Understanding structures, classes, and instances
In the previous chapter, you learned some of the basics of the object-oriented paradigm, including classes and objects, which are also known as instances. We started working on an app required by an acrylic paint manufacturer who wanted to take full advantage of the popularity of an admired YouTuber, painter, and craftswoman. We ended up creating a UML diagram with the structure of many classes, including their hierarchy, properties, and methods. It is time to take advantage of the Xcode Playground to start coding the classes and work with them.
Note
We can also execute all the examples included in this chapter in the Swift REPL in either macOS or Linux. In addition, we can execute the samples in the web-based IBM Swift Sandbox. We will analyze the results of executing the sample code in the Xcode Playground, the Swift REPL, and IBM Swift Sandbox.
In Swift, a class is always the type and blueprint. The object is the working instance of the class...