Swift

“self” in Swift

In Swift, the self keyword refers to the object itself. It is used inside the class/structure to modify the properties of the object. You can assign initial values to properties in the init() method via self. For instance: In this guide, you learn what is self and when you should/should not use it. In addition, …

“self” in Swift Read More »

Classes in Swift

In Swift, you can implement custom types using classes. A class acts as a factory for creating objects. For example, let’s create a Fruit class and two Fruit objects: This is the quick answer to what is a class in Swift. But if you are unfamiliar with classes, there is so much more to learn. …

Classes in Swift Read More »

Structs in Swift

In Swift, you can implement custom types using structures. A structure acts as a factory for creating objects. For example, let’s create a Fruit structure and some Fruit instances of it: This is the quick answer for what is a structure in Swift. However, if you are unfamiliar with structures, there is so much more …

Structs in Swift Read More »