If you haven’t checked out Day 2 in the journey, you can check that out right here.
Polymorphism and Typecasting
The concept of polymorphism is that any instance of a subclass is inherited from its superclass can be treated just as either a subclass or its superclass — it’s essentially the both at the same time.
In short, an object can represent both as its class and its superclass in the same time.
Typecasting is when you are converting an object from one type to another.
There are 3 types, but you will more commonly encounter these two:
If you haven’t checked out Day 1 in the journey, you can check that out right here.
We’ll start this day with another type of flow control called switch/case statement. It’s important to keep in mind that Swift always want to be absolutely certain that there is a result, so in other words, it is exhaustive.
The reason why the switch/case statement above was able to execute is because we made sure it was exhaustive by adding the “default” portion, which takes care of the rest of the possible outcomes.
NOTE: You can also apply closed range operators in…
Let’s start with the absolute basics:
iOS is the operating system that “operates” on iPhones and iPads. It’s responsibility is to be accountable of the rudimentary functionalities of an everyday phone like making calls or running your basic app from the App Store.
macOS is the operating system for Apple’s desktop, and it is like a fore-father of the other Apple operating systems such as the iOS operating system that we have discussed above.
watchOS is recognized as Apple’s smallest operating system.
Swift is the current go-to programming language that Apple uses to build apps for the operating systems above…