Mastodon
Episode 47

Did You Know Apple Lives In California?

00:00:00
/
02:09:24

September 21st, 2021

2 hrs 9 mins 24 secs

Season 1

Your Hosts
Tags

About this Episode

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.

Today, we discuss:

Also, join us for #CompleteTheCode and Compiler Error, two segments that test both your knowledge and our knowledge on Swift, Apple, and all things development!

Your hosts for this week:

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.

Sponsor

This week's episode of Code Completion is brought to you by Huuungry. Search for Huuungry on the iOS App Store today to give it a try: https://apps.apple.com/app/apple-store/id1448552588?pt=14724&ct=CodeCompletion1&mt=8

Complete the Code

How would you transform the code below to use the new async/await pattern?

// 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 Compiler Error has a 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.
2 - For loops will detect if you type the singular form of an existing collection type and autocomplete the entire statement for you.
3 - 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.
4 - 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.