CodeCompletion.io

Episode 4: Clocking in at 392 charact…

Welcome to Code Completion, Episode 4! 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! This time, we are joined by special guest, Dan Morse! Be sure to follow them on Twitter at @danandami.

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 interviews are like in 2020 when everything is remote.
  • How to get acclimated to a new team as a junior developer.
  • The pros and cons of Test Driven Development.

🚧 #CompleteTheCode

This week's #CompleteTheCode:

Invert and reduce the following if statement without introducing any new variables or statements:
1
2
3
4
5
6
7
8
9
10
11
12
let boolA, boolB, boolC: Bool
let intA, intB, intC: Int

// TODO: Invert this statement so we don't need an else block:
if boolA && !boolB || (boolC && intA == intB || intC > intA) {
    // Do Nothing
} else {
    print("The condition above was not met. Do the thing!")
}

// !(boolA && !boolB || (boolC && intA == intB || intC > intA))
// ... is not a solution!

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

⚠️ Compiler Error

  1. Clocking in at 392 characters, encode­Reprojection­To­Command­Buffer:­source­Texture:­previous­Texture:­destination­Texture:­previous­Luminance­Moments­Texture:­destination­Luminance­Moments­Texture:­source­Texture2:­previous­Texture2:­destination­Texture2:­previous­Luminance­Moments­Texture2:­destination­Luminance­Moments­Texture2:­previous­Frame­Count­Texture:­destination­Frame­Count­Texture:­motion­Vector­Texture:­depth­Normal­Texture:­previous­Depth­Normal­Texture:­ is the longest public method name as of iOS 13, and surely does something, but it’s documentation is still marked as No Overview Available.
  1. The smallest on this list, convolve­With­Destination:temp­Buffer:­source­Offset­To­Region­Of­InterestX:­source­Offset­To­Region­Of­InterestY:­kernel:­kernel­Height:­kernel­Width:­divisor:­background­Color:­options:­ is one of many related Objective-C methods in the Accelerate framework for manipulating images.
  1. A private Method on UIViewController, attention­Class­Dump­User:­yes­Its­Us­Again:­although­Swizzling­And­Overriding­Private­Methods­Is­Fun:­it­Wasnt­Much­Fun­When­Your­App­Stopped­Working:­please­Refrain­From­Doing­So­In­The­Future­Okay­Thanks­Bye: is actually a no-op, though is used by some third party libraries.
  1. Related to CarPlay, init­With­Enable­Fan:­enable­Air­Conditioner:­enable­Climate­Control:­enable­Auto­Mode:­air­Circulation­Mode:­fan­Speed­Index:­fan­Speed­Percentage:­relative­Fan­Speed­Setting:­temperature:­relative­Temperature­Setting:­climate­Zone: is a public method with full online documentation, though now deprecated.
Compilation Results

Our special guest went first, followed by Ben. Let's see how they did!

1. Clocking in at 392 characters, encode­Reprojection­To­Command­Buffer:­source­Texture:­previous­Texture:­destination­Texture:­previous­Luminance­Moments­Texture:­destination­Luminance­Moments­Texture:­source­Texture2:­previous­Texture2:­destination­Texture2:­previous­Luminance­Moments­Texture2:­destination­Luminance­Moments­Texture2:­previous­Frame­Count­Texture:­destination­Frame­Count­Texture:­motion­Vector­Texture:­depth­Normal­Texture:­previous­Depth­Normal­Texture:­ is the longest public method name as of iOS 13, and surely does something, but it’s documentation is still marked as No Overview Available.

Everyone thought this was true, and it is indeed a code completion! It actually beats out second place by over 100 characters… Learn More → More →

2. The smallest on this list, convolve­With­Destination:temp­Buffer:­source­Offset­To­Region­Of­InterestX:­source­Offset­To­Region­Of­InterestY:­kernel:­kernel­Height:­kernel­Width:­divisor:­background­Color:­options:­ is one of many related Objective-C methods in the Accelerate framework for manipulating images.

Everyone also thought this was true, but it was the compiler error, largely due to the fact that Accelerate is largely a C framework, meaning no such Objective-C method exists (though there is a vImage_­Error vImage­Convolve_­ARGB­8888(...);)! Learn More →

3. A private Method on UIViewController, attention­Class­Dump­User:­yes­Its­Us­Again:­although­Swizzling­And­Overriding­Private­Methods­Is­Fun:­it­Wasnt­Much­Fun­When­Your­App­Stopped­Working:­please­Refrain­From­Doing­So­In­The­Future­Okay­Thanks­Bye: is actually a no-op, though is used by some third party libraries.

Dan thought this was completely made up, but it was a code completion after all! Learn More →

Which leaves…

4. Related to CarPlay, init­With­Enable­Fan:­enable­Air­Conditioner:­enable­Climate­Control:­enable­Auto­Mode:­air­Circulation­Mode:­fan­Speed­Index:­fan­Speed­Percentage:­relative­Fan­Speed­Setting:­temperature:­relative­Temperature­Setting:­climate­Zone: is a public method with full online documentation, though now deprecated.

…which Ben doubted could actually be in iOS with this level of control, but it was indeed a code completionLearn More →

🎁 Sponsor

This week's episode of Code Completion is brought to you by JohnnyB's Bon Voyage eCommerce App course. Visit bon-voyage.app/course and be sure to follow Bon Voyage's instructor @jonnybcodes on Twitter to learn more and stay up to date with all his courses!

📹 Watch the Stream