A quick primer on recursion

I thought it beneficial to capture this super simple example of recursion I tweeted because it’s usually scary, obtuse, or part of a larger topic. countdown(int i) { print(i); if (i > 0) countdown(i - 1) } This means countdown(5) would print the following: “5”, “4”, …

I just encountered a 400 line method. How it grew to this size and what it does make sense but that’s not tenable. Time to break it apart into readable, logical chunks for future maintainers. And then add the new feature 😉 #ProgrammingTips

When debugging or extending a particular area of code (like a file/object) I strive for a negative line change by removing unused methods and updating to modern styles and practices. Better for readability and binary both when done properly🤞#ProgrammingTips

Looking for Xcode’s Siri intents that are based on your definition file while working with Swift? 😕 Use “Generated Interfaces” in the Related Items menu from the jump bar’s left side and you’ll find them in AppName-Swift.h 📖 #ProgrammingTips

TIL defining 3D touch application shortcuts doesn’t allow you to control which side the icon appears on… and it’s a bit random between first and third party apps alike (typically on the left but not guaranteed) #iOS #ProgrammingTips

I’ve said it before and I’ll say it again: guard let varName = value else { return } is my jam. #ProgrammingTips

There’s no guarantee what thread (via a queued dispatch most likely) your -dealloc implementation will be called on. Never do anything in it that could touch UI. #ProgrammingTips

Short-lived objects shouldn’t use KVO at all as they are highly susceptible to unexpected performance penalties. Scope your KVO usage as narrowly as possible and mind the lifecycles. #ProgrammingTips

Building an iOS app without any xibs or storyboards? Make sure you add the base set of launch images or your app will default to the smallest iPhone size possible (480x320). This results in some massive letterboxing depending on Simulator settings. #ProgrammingTips

Constants (define HOUR 60*60) are great for clarity/intent but don’t waste compute cycles and energy: use 360 or whatever the constant should be. #ProgrammingTips