CodeCompletion.io

Episode 17: It would be nicer if things were nicer

Welcome to Code Completion, Episode 17! We are a group of iOS developers and educators hoping to share what we love most about development, Apple technology, and completing your code!

Follow us @CodeCompletion on Twitter to hear about our upcoming livestreams, videos, and other content.

Be sure to also sign up to our monthly newsletter, where we will recap the topics we discussed, reveal the answers to #CompleteTheCode, and share even more things we learned in between episodes.

You are what makes this show possible, so please be sure to share this with your friends and family who are also interested in any part of the app development process.

⭐️ This Week's Topics

  • Spencer's MacBook Air setup woes.
  • The App Store's new 15% commission rate for small businesses.
  • Differences between AppKit, UIKit, and the various flavors of SwiftUI when starting a new Mac app.

⚠️ Compiler Error

This week's theme: Esoteric Objective-C “standard library” features!

  1. Tagged pointers encode their entire object into the non-addressing bits of a pointer, ultimately allowing faster allocations for specific hard-coded classes known by the runtime.
  1. NSZone’s primary purpose was to allow objects to be allocated within the same memory page, so swap would be fast, and those objects could be free’d in one go.
  1. NSProxy is a non-NSObject base class that allows for message dispatch to be easily redirected to another object, but does not have an initializer implemented for subclasses to fall back on.
  1. NSAtom is a special class that is ultimately the boolean-opposite to nil: any message you send it will always return an NSAtom, which is very intentionally equal to 1.
Compilation Results

This time, Fernando went first, followed by Spencer. Let's see how they did!

1. Tagged pointers encode their entire object into the non-addressing bits of a pointer, ultimately allowing faster allocations for specific hard-coded classes known by the runtime.

Both of our completionists thought this was true, but it was unfortunately the compiler error! Turns out the entire addressing bit-space is used for the payload, and any class can request a tag at runtime! Learn More →

2. NSZone’s primary purpose was to allow objects to be allocated within the same memory page, so swap would be fast, and those objects could be free’d in one go.

Spencer fell for this one, which was actually a code completion! Learn More →

3. NSProxy is a non-NSObject base class that allows for message dispatch to be easily redirected to another object, but does not have an initializer implemented for subclasses to fall back on.

Both of our completionists thought this was a code completion… because it was a code completion! Learn More →

Which leaves…

4. __NSAtom is a special class that is ultimately the boolean-opposite to nil: any message you send it will always return an __NSAtom, which is very intentionally equal to 1.

…which Fernando was unable to continue his streak with, because it was also a code completion! Learn More →

🎁 Sponsor

This week's episode of Code Completion is brought to you by Pennant! Search for Pennant on the iOS App Store today to give it a try!

📺 Watch the Stream