Please note, this blog entry is from a previous course. You might want to check out the current one.
The sixth lecture contains theory interspersed with demos of the just learned topics.
Extensions
Extensions allow to add methods and properties to classes even if the source is not available. It is not possible to override existing methods and properties. New properties can not be used to store data.
Protocols
Protocols define APIs of methods and properties a caller should provide. It has no storage or implementation associated.
protocol SomeProtocol : class, InheritedProtocol1, InheritedProtocol2 { var someProperty: Int { get set } func aMethod(arg1: Double, anotherArgument: String) -> SomeType mutating func changeIt() init(arg: Type) }
Continue reading “cs193p – Lecture #6 Protocols and Delegation, Gestures”