Hiding Implementation Details Using internal Properties
Oct 8, 2018, 10:25 AM
Swift comes with five access-level modifiers: open, public, internal, fileprivate and private. The internal modifier leads to entities being available for use only within their defining module. It’s a default modifier but it starts getting...
Why #if DEBUG Conditional Should Be Avoided in Library Code
Sep 24, 2018, 8:55 AM
Conditional Compilation along with Active Compilation Conditions is a way to alter the app’s behavior depending on the build configuration. For example for the code to compile only in the Debug configuration, we can do:
#if DEBUG
...
Future-Proof Dependency Injection for Storyboard-Based View Controllers
Dec 6, 2017, 10:05 AM
One of the issues introduced by storyboards is that they make it impossible to pass dependencies to view controllers in initializers. I proposed an API modification in past that would allow for exactly that, but alas, it doesn’t seem to be...
Stop Xcode from constantly rebuilding your project because of @IBDesignable
Nov 15, 2017, 9:30 AM
If you use Interface Builder along with @IBDesignable attribute you may have noticed that Xcode sometimes builds your project even though you didn’t trigger a build. This is because it needs to compile views marked with @IBDesignable to be...
Optimizing Swift build times →
Nov 8, 2017, 2:20 PM
I spent some time recently trying to optimize build times of a project I contribute to.
To my surprise, the knowledge needed to do that was scattered around many blog posts and tweets.
So, I decided to do something about that by putting...
Surprising behavior of non-optional @NSManaged properties
Sep 18, 2017, 10:20 AM
Core Data is not a first-class citizen in the Swift world. Its inherently dynamic nature is lurking at us through an attribute created specifically for it: @NSManaged. Let me show you how this dynamic nature caught me off guard. I ended up...
Catching Leaky View Controllers Without Instruments
Jun 26, 2017, 9:40 AM
One of the well-known techniques for finding memory leaks caused by retain cycles is checking if all view controllers get deallocated when they’re not on screen anymore. This is a process that should be manually repeated before each...
Avoiding Third-Party UI Libraries
May 31, 2017, 9:50 AM
There’s been some discussion recently in the iOS community about pros and cons (OK, mostly cons) of using third-party dependencies. Many arguments I saw were rather generic — grouping all third-party libraries into one basket. As with most...
Introducing IBAnalyzer
Jan 31, 2017, 9:00 AM
I'm happy to announce the release of my new tool called IBAnalyzer.
Its aim is to allow you to catch common xib and storyboard-related issues without running an app or writing unit tests.
With IBAnalyzer, you're currently able...
Imagining Dependency Injection via Initializer with Storyboards
Dec 14, 2016, 10:15 AM
Storyboards, both their good and bad parts, are something I already analyzed in the past. To recap, they just don’t feel like the first class citizen in the Swift world. Third party tools can help but only with some of the issues, e.g....