Ways to Unwrap Optionals in Swift

In this post I will explain all the possible ways to unwrap an optional in Swift. Lets look at them one by one with their uses and consequences of using them Force Unwrapping This is the easiest way to unwrap an optional and that’s why tempting. You need to just put exclamation mark (!) after… Continue reading Ways to Unwrap Optionals in Swift

Completion Handler in Swift

When you are new to Swift, and you see completion handlers, these are the most mysterious guys around. You might have found it difficult to get grasp on it. Don’t worry we will demystify them in this article. I will explain to you what are they, why are they there and how they operate. After… Continue reading Completion Handler in Swift

Delegate in Swift

Delegation is a design pattern that enables a class or structure to hand off (or delegate) some of its responsibilities to an instance of another type. Conversely speaking Delegate is nothing but a class/structure that does some work for another class or structure. Advantages of using Delegate Delegate helps in keeping Class/Struct clean. Class can… Continue reading Delegate in Swift

Class Vs Struct in Swift

In this article we will go through the differences between Class and Struct in Swift. We will consider all the differences but will take a deep dive into the main difference. i.e. The Class is reference type whereas Struct is value type in Swift. By this I mean that the Class instances are hold as… Continue reading Class Vs Struct in Swift

defer in Swift

defer is used to define the set of statements that should be executed just before the control leaves the current scope of execution. The statements defined in defer block are executed irrespective of how the execution control leaves the scope in which defer is defined. The statements defined in defer block are executed just before… Continue reading defer in Swift

guard In Swift

guard keyword, as the name suggests, guards the execution in Swift. Either you meet the condition, or just get out of here. The syntax for guard goes like this If you know swift you would be knowing that the condition here should be Bool. The else clause is compulsory with guard. If the condition in… Continue reading guard In Swift