Easily detect the absence of value in variable or constant using Optionals
Optional is an enum that has 2 states, the first state is where there is a value and that value is of some type for example Int, and the other state is nil where there is no value at all. Continue reading “Optionals in Swift”
Observe and respond to property changes
What is Property Observer
Property Observer observe and respond to changes in property’s value.
It is called every time a property’s value is set, even if the new value is the same as the old value. Continue reading “Property Observer in Swift”
Swift version of Enum is much more powerful
What is Enum
Enum is a data structure that can only has discrete values.
It is always used if you need to store a group of related values like directions on map or compass(North, East, West, South), status of download process (Completed, Cancelled, Paused, Downloading) and so on. Continue reading “iOS beginner’s guide to Enum in Swift”
Customize every single character in your string
What is NSAttributedString
It is an object that manages string and associated set of attributes applied to individual characters or range of characters.
It is a class belongs to the Foundation framework and it is NOT a subclass of NSString. Instead it contains NSString object that it applies attributes to.
The cluster has two public class NSAttributedString and NSMutableAttributedString Continue reading “iOS developer’s guide to NSAttributedString in Swift 3”
Working with Dates in Swift
To start working with dates in iOS you must be familiar with at least these three objects: Date, DateFormatter and DateComponents.
Date is a struct that belongs to the Foundation framework.
It represents a specific point in time independent of any calendar or time zone.
Date structure bridges to the NSDate class.
It provides methods for creating dates, comparing dates and calculating time intervals between dates. Continue reading “Working with Dates in Swift”
Swift provides three collection types for storing collections of values
Here we will try to show the differences between them so you can easily decide which one to use in every situation.
Array is ordered collection so you can access any element inside it using its index.
Arrays can contain duplicates. Continue reading “Set, Array and Dictionary what’s the differences?”