Episode 12: The First Rule of Dev Club…
Welcome to Code Completion, Episode 12! We are a group of iOS developers and educators hoping to share what we love most about development, Apple technology, and completing your code! This time, we are joined by special guest, Dan Morse! Be sure to follow them on Twitter at @JamesWMcDougall.
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
- James's path from audio engineer to app developer.
- How to get an interview when you don't have experience.
- Fudging your resumes, but not lying to the hiring manager.
🚧 #CompleteTheCode
Last week's #CompleteTheCode:
What sort of crash could easily occur with the following code?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class Person: CustomStringConvertible { var name: String = "" unowned var twin: Person? private init() { } static func makeTwins() -> (Person, Person) { let (a, b) = (Person(), Person()) a.twin = b; b.twin = a return (a, b) } var description: String { "Twin: \(twin?.name ?? "")" } }
Be sure to tweet us with hashtag #CompleteTheCode if you know the answer!
⚠️ Compiler Error
- The UTF-32 view provides access to each character as a 4-byte UInt32, representing the complete range of all 4 billion unicode code points, but in their original, possibly decomposed, forms.
- The UTF-8 view optimizes for memory at a disadvantage to manipulation speed, since each unicode character may be represented by one or more bytes, making length calculations costly, but necessary for many C APIs.
- Easily accessibly by treating a string like a collection, the default view represents normalized characters as they would be displayed on screen, even if they were originally decomposed.
- The UTF-16 view is optimal when interacting with unicode libraries such as Objective-C’s NSString since it vends UInt16 code-points, as is standard in many programing models.
Compilation Results
As our special guest, James went first, followed by Fernando. Let's see how they did!
2. The UTF-8 view optimizes for memory at a disadvantage to manipulation speed, since each unicode character may be represented by one or more bytes, making length calculations costly, but necessary for many C APIs.
Both of our completionists thought this was true, and it is indeed a code completion! Learn More →
1. The UTF-32 view provides access to each character as a 4-byte UInt32, representing the complete range of all 4 billion unicode code points, but in their original, possibly decomposed, forms.
James was tempted by this one, but ultimately chose number 3, and Fernando, a contrarian, ignored this wisdom, which is unfortunate because it was the compiler error! Although there is a Unicode Scalar View, there is no native utf32 view that vends plain UInt32s… Learn More →
3. Easily accessibly by treating a string like a collection, the default view represents normalized characters as they would be displayed on screen, even if they were originally decomposed.
James ultimately though this one was being sneaky, but it was a code completion afterall! Learn More →
Which leaves…
4. The UTF-16 view is optimal when interacting with unicode libraries such as Objective-C’s NSString since it vends UInt16 code-points, as is standard in many programing models..
…which Fernando should have known but picked anyway, as it was also a code completion. Learn More →
🎁 Sponsor
This week's episode of Code Completion is brought to you by Not Phở. Click here or search for “Not Pho” on the iOS and macOS App Store today to give it a try.