Protocols and associatedtypes.

One of the most promising feature in Swift is associatedtype. Prior to Swift 2.2, the keyword used to define a placeholder type inside protocol was typealias. But this was very confusing as typealias in protocols means something else than in other places.

Read More

Swift type inference and UIColor convenience initialiser.

The Swift language and its type system incorporate a number of popular language features, including object-oriented programming via classes, function and operator overloading, subtyping, and constrained parametric polymorphism. Swift makes extensive use of type inference, allowing one to omit the types of many variables and expressions.

Read More

Swift protocols with 'get set' and 'get' properties.

Protocols in swift defines a blueprint of methods, properties, and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements. Any type that satisfies the requirements of a protocol is said to conform to that protocol.

Read More