Classes are a very important part of any Object Oriented language, and Swift is no exception. When I explain classes to people, I usually think of one to describe a car. That’s a bit cliché, and done in a WWDC video, so let’s do something different.
Creating A Class in Swift
Let’s say we are making a chat program in Swift. It primarily sends messages in text format, but occasionally, it will also send images. We will first create our more general Message class, which we will specialize into those different formats later:
class Message { //Message code goes here }