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 interesting only once we split our codebase into modules.
In this article, we’ll see how to provide an ability to inject a framework’s data structure into the framework’s classes, while at the same time keeping its internals hidden.
Read more →
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
performAdditionalChecks()
#endif
In this article, I’ll show why these kinds of conditional blocks shouldn’t be used directly in the source code of libraries distributed to other developers.
Read more →
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 high on the priority list for UIKit. I recently came up with a new approach leveraging code generation which I’m excited to show you today.
Read more →
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 able to render them in Interface Builder. What's problematic is that these builds seem to occur a bit too often.
Read more →
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 everything I knew and learned in a single document.
It's available on GitHub here.
Hope you learn something new!