I spent a considerable amount of time with the
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 😉.
Making Date Strideable
The Swift programming language is all about clarity, but the current
Date APIs leave us wanting. The
Strideable protocol is part of the Swift Standard Library, and is applicable to various numeric data types.
Date isn't entirely a numeric type, but it too could benefit from a
Strideable API. Warren Gavin gives it a shot!
The weirdest subclass I've ever written
Apple declared war on object oriented programming (OOP) 2 years ago, and the Swift community followed suit. While protocol oriented programming (POP) has clear benefits and promise, I agree with Matt Gallagher that we shouldn't throw OO by the wayside just yet. Certain problems are simply more suited to OO. Swift also needs to mature a bit to realize the full potential of POP.
Data Consistency in an Unpredictable World (video)
Wendy Lu from Pinterest discusses how they ensure data consistency by combining immutable model objects with PINCache (their open-source object cache).
Nuts and bolts
Tools and frameworks I came across which may be interesting:
Handy command-line tool for linting and autocorrecting Swift source files. It comes with a swath of built-in linting rules, and basic YAML syntax for customizing the ruleset. It's easily integrated with Xcode (by adding a Run Script Phase) and Git (e.g. as a commit hook).
While conducting my calendar-based research, I came across
FSCalendar. It's an all-purpose, open-source, fully customizable calendar component for iOS. I decided to roll my own, but
FSCalendar looks promising if you want to save time and don't mind a pre-built solution.
Hurl.it online REST client
This cunningly named web app is a lightweight REST client. While I use Charles Web Proxy for most of my HTTP-related work,
hurl.it is still useful. It's entirely web-based and self-contained, foregoing the need for a browser add-on or a separate app.
A new scientific paper argues the moon is totally a planet—and Pluto is too
Uhuh: “Why did you send New Horizons to Pluto if it’s not a planet anymore?”