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 a context menu to our app.
Need help? Tweet me @twostraws!
SPONSORED ViRE offers discoverable way of working with regex. It provides really readable regex experience, code complete & cheat sheet, unit tests, powerful replace system, step-by-step search & replace, regex visual scheme, regex history & playground. ViRE is available on Mac & iPad.
Link copied to your pasteboard.