Using protocol composition for dependency injection, implementing UI mixins in Swift & more
Swift 3.1 is out, and it should be source-compatible for a change 😈. Some highlighted features and improvements are failable numeric conversions, additions to the `Sequence` protocol, improvements to extensions and support for nested generics. The easiest way to take advantage of Swift 3.1 is to get the new Xcode 8.3 and pray no new Xcode bugs have been introduced 😏.
This week: rubbing shoulders with Xcode competitor AppCode, Swifty Android programming with Kotlin and more than you'll ever need to know about `Sequence` and `Collection`. Oh, and please, let's NOT change `fileprivate` and `private` again.
This week: among other things, why storyboards should go take a hike, and how to unit test them if you do decide to use them (or not).
SwiftLint was developed by the nice folks @realm. It's a great open-source tool for establishing and enforcing a formal coding style in Swift. It runs on the command-line, but it can be hooked into Xcode directly too. It also boasts an "autocorrect" feature, which sweeps through your code and automatically fixes the most trivial violations (e.g., colon positioning, double white spaces, etc.). I created a Git commit hook which does exactly this, every time a team member makes changes.
This week in.. stuff that's dying: why relying on third-party frameworks is killing angels, why UITableView is dying and why memory leaks are killing your app.
I spent a considerable amount of time with the `NSCalendar` and `NSDate` APIs this week (building a custom calendar component), which is why the headlining article struck a chord with me. Date and calendar calculus are always painful, but I've learned to lighten the load by letting `NSCalendar` bear the brunt. Also, never, ever, divide by 24, 31, 365, or the like 😉.
Can't believe we're still dealing with this in 2017? Well, that makes two of us. While retain cycles are easy to fix, they're also hard to spot while eyeballing a codebase. Recently, I've found that a single unit test can provide solace. With just a few lines of code, it runs continuously as you make changes, all the while verifying you haven't introduced any new memory leaks.
This week's issue discusses the art of refactoring, improving Swift completion blocks, Overcast.fm's new app design, and an interesting account of Swift 3 migration pain. Check the "nuts and bolts" section if you're interested in Regular Expression stuff. I wasn't, but I didn't have a choice 😫.