CodeCompletion.io

Episode 5: Emacs Should Die a Fiery Death

Welcome to Code Completion, Episode 5! We are a group of iOS developers and educators hoping to share what we love most about development, Apple technology, and completing your code on this brand new show!

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

  • When to rewrite a project from scratch, when to buckle down and conquer technical debt, and when to do a little something in between.
  • The importance of documenting code, and how the lack of documentation stifles newcomers from becoming established developers.

🚧 #CompleteTheCode

This week's #CompleteTheCode:

Review the following code — what might the developer have overlooked?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class DateCell: UITableViewCell {
    
    private static let dateFormatter: DateFormatter = {
        let dateFormatter = DateFormatter()
        dateFormatter.dateFormat = "YYYY-MM-dd"
        return dateFormatter
    }()
    
    var date: Date? {
        didSet {
            switch date {
            case .some(let date):
                textLabel?.text = Self.dateFormatter.string(from: date)
            case .none:
                textLabel?.text = "N/A"
            }
        }
    }
    
}

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

⚠️ Compiler Error

  1. Although the same can be done using modifier and arrow keys, the text cursor can be quickly moved to the beginning and to the end of a document by using ⌃A to go to the beginning, and ⌃Z to go to the end.
  1. You may know of the ⌘⌫ command to delete the entire line to the left of the text cursor, but ⌃K can be used to delete the line to the right of the text cursor.
  1. Available as an alternate clipboard, ⌃K and ⌃Y represent the kill and yank operations that let you cut and copy text without overriding your main clipboard. The clipboard they use is called the kill ring.
  1. ⌃T is a useful command for transposing two letters that were typed out of order, by flipping the characters on each side of the text cursor.
Compilation Results

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

4. ⌃T is a useful command for transposing two letters that were typed out of order, by flipping the characters on each side of the text cursor.

Everyone thought this was true, and it is indeed a code completion! Learn More →

3. Available as an alternate clipboard, ⌃K and ⌃Y represent the kill and yank operations that let you cut and copy text without overriding your main clipboard. The clipboard they use is called the kill ring.

Fernando was doubtful and thought this one was the compiler error, but it was a code completion after all! Learn More →

2. You may know of the ⌘⌫ command to delete the entire line to the left of the text cursor, but ⌃K can be used to delete the line to the right of the text cursor.

This time Ben was hesitant, but this one was also a code completion! Learn More →

Which leaves…

1. Although the same can be done using modifier and arrow keys, the text cursor can be quickly moved to the beginning and to the end of a document by using ⌃A to go to the beginning, and ⌃Z to go to the end.

…which Spencer doubted for all the right reasons, because it was indeed the compiler error! ⌃A will go to the beginning, but the geginning or a line, not the document, and ⌃Z was completemy made up. ⌘↑ and ⌘↓ can be used on the mac to go to the top and bottom of the document… Learn More →

It turns out hat most of these bindings are fully customizable! Check out the list of action methods you can call to extend functionality even further.

🎁 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.

📺 Watch the Stream