CodeCompletion.io

Episode 47: Did You Know Apple Lives In California?

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

🚧 #CompleteTheCode

This week's #CompleteTheCode:

How would you transform the code below to use the new async/await pattern?
1
2
3
4
5
6
7
8
9
10
11
// How would you transform the code below to use the new async/await pattern?

print("Preparing request…")

urlSession.dataTask(with: httpRequest) { data, response, error in
    DispatchQueue.main.async {
        print("Received response: \(response)")
    }
}.resume()

print("Sent request!")

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

⚠️ Compiler Error

This week's theme: New Autocompletions in Xcode 13

  1. Our favorite optional binding if let will now autocomplete existing optionals as the left-hand side of the binding as you type it.
  1. For loops will detect if you type the singular form of an existing collection type and autocomplete the entire statement for you.
  1. When calling functions, the editor will prioritize variables with similar names to the argument you are autocompleting to make getting through long argument lists easier.
  1. When dot-chaining members of an expression like view.undoManager.canUndo, the editor will now allow you to skip and will automatically insert undoManager for you if you type view.canUndo.

🎁 Sponsor

This week's episode of Code Completion is brought to you by Huuungry. Click here or search for Huuungry on the iOS App Store today to give it a try.

📺 Watch the Stream