Swift has a narrow rule whereby a class with a designated initializer with no arguments is implicitly called by dereived class initializers if no other super.init call is specified and it is otherwise unambiguous. This is why you don’t need to explicitly call super.init() when subclassing NSObject, for example.
You can use two different attributes—@IBDesignable and @IBInspectable—to enable live, interactive custom view design in Interface Builder.
from Apple doc
This will cause a compiler error:
1 2 3 4
Putting spaces around operators will resolve the compiler error i.e.
let max = a > b ? a : b
In Swift it may be necessary to use
autorelease if we are using objective-c objects. e.g.
1 2 3 4 5
This is a clang doc regarding ARC and retain count. A lot of info to digest…
This piece code here:
1 2 3
Cannot convert the expression's type 'Boolean' to type 'Void'
It is because if the block does not have a return statement, the compiler uses the result of the last statement as the return value
return () as the last expression to the block fixes the problem