iOS beginner’s guide to Enum 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”

iOS developer’s guide to NSAttributedString in Swift 3

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

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 struct

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”

Set, Array and Dictionary what’s the differences?

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:

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?”