CodeCompletion.io

Episode 11: Fernando's Going to Eat His Hat

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

  • If 5G is as useful a feature as Apple made it out to be.

🚧 #CompleteTheCode

This 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

  1. Just introduced this month, swift-algorithms is a new package that makes complex sequence and collection algorithm implementations available which wouldn’t otherwise fit in with the standard library.
  1. A foundational library to many server-side swift initiatives, swift-nio exposes high level building blocks for interacting with non-blocking IO, such as files, streams, and datagrams.
  1. Built on top of swift-nio, swift-metrics is a package primarily intended for web analytics that makes it easy to collect data from your server application in a privacy conscious way.
  1. Re-implementing much of the functionality URLSession provides, async-http-client is a high performance HTTP client for Swift actively maintained by the Swift Server Work Group.
Compilation Results

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

1. By using extended delimiters for string literals, all special characters including the backslash will be represented as normal characters.

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

4. Re-implementing much of the functionality URLSession provides, async-http-client is a high performance HTTP client for Swift actively maintained by the Swift Server Work Group.

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

2. A foundational library to many server-side swift initiatives, swift-nio exposes high level building blocks for interacting with non-blocking IO, such as files, streams, and datagrams.

Fernando had doubts whether Swift NIO was actually considered a high-level library, and Ben followed his lead, which is unfortunate because it was still a code completion! Learn More →

Which leaves…

3. Built on top of swift-nio, swift-metrics is a package primarily intended for web analytics that makes it easy to collect data from your server application in a privacy conscious way.

…which everyone incorrectly thought was another code completion, but it was the compiler error! Not only is swift-metrics not built on Swift NIO, it is also not meant for web analytics, and is instead there to see if your application is performing. Learn More →

🎁 Sponsor

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

📺 Watch the Stream