There’s a classic computer science book called Structure and Interpretation of Computer Programs, and in the preface the authors write some important words: “programs must be written for people to read, and only incidentally for machines to execute.”
All those and many more can be answered by that single quote: because our goal must always be to make our intent clear to ourselves and other developers. The CPU running our code doesn’t care about data types, comments, access control, and more, but if you want to write great software that is scalable, testable, and maintainable, you need to add some rules.
We’re actually going to use some interesting access control today, relying on two Swift features that don’t get used nearly enough: the
fileprivate access control, and custom access control for setters. As with many features these aren’t the kinds of things you’ll use every day, but it’s just one more skill to add to your growing collection and worth keeping around!
Today you have three topics to work through, in which you’ll write the “Me” tab, scan a QR code, then add swipe actions to our app.
Need help? Tweet me @twostraws!
SPONSORED Fernando's book will guide you in fixing bugs in three real, open-source, downloadable apps from the App Store. Learn applied programming fundamentals by refactoring real code from published apps. Hacking with Swift readers get a $10 discount!
Link copied to your pasteboard.