In this post we will be seeing Custom Types As Raw Value for Enum in Swift. So for your custom type (Class/Struct) to be used as raw value of enums you will need to conform to Equatable and one of the above mentioned protocols.
You use implicitly unwrapped optional only in places where the value of the variable is present before it is first accessed. If you try to access the the value of implicitly unwrapped optional, and the value is nil, you will a runtime exception.
A guard statement is used to transfer program control out of a scope if one or more conditions aren’t met also called as early exit. i.e. Either you meet the condition asked, or get out of the scope.guard let is also an alternative to if let, which also unwraps optionals. guard let will unwrap an optional for you and if it finds nil inside, it expects you to exit the function, loop, or condition you used it in.
Functions can be tricky if you are not aware of the basics. In this post we will be seeing what are functions and how to handle them.
How often you see a newbie programmer trying to learn new programming language and struggling with new keywords. One of those keywords are "var" and "let" . In this post I'm going to concentrate on these two keywords "var" and "let" used in Swift Programming Language. Variable: Variable is a name given to memory location. … Continue reading Swift let vs var