The iOS Huddle #2
Wednesday, October 26, 2016
The iOS Huddle is our monthly roundup of the best links shared in the Black Pixel iOS team’s Slack channel.
From BPXL Craft
In case you missed it, here is a recent iOS-centric series from BPXL Craft:
Event Delivery on iOS: Parts 1, 2, and 3
Brandon Alexander rounds out the excellent series on event delivery. Part 1 covers touch events, hit-testing, and gesture recognizers. Part 2 finishes the remaining events defined in UIResponder, while part 3 explains the target-action pattern.
From Around the Watercooler
Debugging Magic
Sometimes it can be really challenging to track down the root causes of bugs. Luckily we’ve discovered some hidden gems that can make this process easier.
- Apple provides technotes on “secret” debugging for iOS and macOS. Just make sure not to ship your apps using any of these methods as they can be grounds for rejection.
- Shaps has been on a roll lately with lots of informative tweets. Use the private API _viewControllerForAncestor to climb the superview hierarchy looking for the parent view controller. Also find out how to dump the print function to make console output prettified.
Pickable Enums
Mapping a list of savable options to a table or picker view is a chore. Why not channel your inner Tom Sawyer and let the PickableEnum protocol extension do the work for you instead?
NSNotificationCenter Changes in iOS 9
In a welcome change to NSNotificationCenter, non-block based observers are now zeroing weak references so there is no need to unregister them. Read about these changes and other tips for debugging notifications. (For bonus points, delve into the memory of Mike Ash for a detailed explanation of why zeroing weak references matter.)
Advanced Swift Operators
Given Swift’s penchant for safety first, it’s not surprising that its arithmetic operators do not overflow by default and will instead throw an error. We discovered that Swift has a second set of arithmetic operators that do overflow in the rare case this functionality is desired. Get the details in the Advanced Operators section of the Swift documentation.
Slow App Startup Times
Users can be fickle and apps that are slow to start are the bane of many. Slow apps are also likely to be rejected by App Review. Use the DYLD_PRINT_STATISTICS environment variable to get very detailed data about the time it takes to load, bind, set up, and initialize.
Drawing Hairlines
When retina displays were released, iOS developers and designers had to start thinking differently. Going from design to code can lead to unexpected behavior because the system converts from points to pixels. Learn how to tweak Core Graphics to draw fine lines when the design calls for it.
A Real Programmer Who Never Learned C
For a lot of Objective-C developers, learning C was a right of passage. Wil Shipley shares a funny story about a real programmer who never learned C.
Taking Revert to tvOS
Developing for tvOS requires a shift in thinking due to the way the focus engine works. Itty Bitty Apps elaborates on their experience moving the Revert app to tvOS.
On Patterns and Practices
All problems in computer science can be solved by another level of indirection, except of course for the problem of too many indirections.
— David John Wheeler
A Controller By Any Other Name
Soroush Khanlou writes about the amorphous “controller” as the kitchen sink and why coming up with better names can lead to cleaner code.
MVVM Is Lipstick on a Pig
As software design evolves there are many new architectures that aim to solve old problems. MVVM is one that feels a step too far for a lot of us. Jaim Zuber elaborates on why it doesn’t always work out in practice.
For more insights on design and development, subscribe to BPXL Craft and follow Black Pixel on Twitter.
Black Pixel is a creative digital products agency. Learn more at blackpixel.com.