CodeCompletion.io

Episode 14: We Broke The First Rule of Dev Club

Welcome to Code Completion, Episode 14! 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

  • What Apple could announce at the One More Time event.
  • How to nail an interview like a pro.

🚧 #CompleteTheCode

This week's #CompleteTheCode:

What key API allows for Swift Arrays and Dictionaries to implement Copy-on-Write (CoW)?
1
2
3
let firstArray = [0, 1, 2]
var secondArray = firstArray // The underlying storage is still shared here
secondArray.append(3) // The underlying storage is copied first, then updated

Be sure to tweet us with hashtag #CompleteTheCode if you know the answer!

⚠️ Compiler Error

  1. Neuralsort makes use of a convolutional neural network to sort at O(2n) speeds on average, though the worst case can take quadratic time.
  1. Spaghetti Sort is capable of sorting its contents at O(n) speeds even in the worst of cases, but requires a quadratic amount of memory in the process.
  1. Bogosort uses the power of random shuffling to achieve a computational complexity of O(n) in the best of cases, but is unfortunately not stable in the process.
  1. Named after Tim, Timsort is used in Swift 5 to perform sorting needs in Arrays, which is especially tuned to reversing the order of an already sorted collection.
Compilation Results

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

2. Spaghetti Sort is capable of sorting its contents at O(n) speeds even in the worst of cases, but requires a quadratic amount of memory in the process.

Both of our completionists thought this was true, and it is indeed a code completion! Learn More →

3. Bogosort uses the power of random shuffling to achieve a computational complexity of O(n) in the best of cases, but is unfortunately not stable in the process.

They both thought this was also factual, and it is also a code completion! Learn More →

1. Neuralsort makes use of a convolutional neural network to sort at O(2n) speeds on average, though the worst case can take quadratic time.

Spencer wasn't so sure about this one, which was the right hunch to have since it was the compiler error! Neuralsort was completely made up, though right up there with a fictional Blockchain sort, it feels like it's just waiting to be invented.

Which leaves…

4. Named after Tim, Timsort is used in Swift 5 to perform sorting needs in Arrays, which is especially tuned to reversing the order of an already sorted collection.

…which Ben thought for sure was too fishy to be true, but it was a code completion after all! Learn More →

🎁 Sponsor

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

📹 Watch the Stream