Using Self in Swift Class Extensions
Posted 10 Aug 2017
It might be tempting to use Self
as a parameter type when extending classes but Swift only allows it
in a protocol or as the result of a class method invocation.
In fact, this is a semantically correct restriction for non-final classes in most cases, except when we
want to use Self
as an argument of the closure, think about completion handlers for example. In that case
Self
is used just as an another method call result which is absolutely valid option.
Managing Temporary Files in Swift
Posted 08 Aug 2017
Reference counting is great in taking unused objects out of memory. The same can be applied to the temporary files we allocate.
Storyboard Tricks
Posted 06 Aug 2017
While looking through another sample project today, I have once again noticed how many string literals and force downcasts accompany most of the storyboard-related code.
Having realized that, I decided to share a few practices I use myself to make my view controller and storyboard handling code more conscious.