Using Self in Swift Class Extensions

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.

Read more…

Managing Temporary Files in Swift

Reference counting is great in taking unused objects out of memory. The same can be applied to the temporary files we allocate.

Read more…

Storyboard Tricks

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.

Read more…