Mastodon
Episode 40

Merge Commits Are Evil

00:00:00
/
00:55:42

August 3rd, 2021

55 mins 42 secs

Season 1

Your Hosts
Tags

About this Episode

Welcome to Code Completion, Episode 40! 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, a segment that tests your 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

What’s the best way to check if the file that is passed in exists or not?

// Assuming these steps need to be performed in the order
// they are presented, how would you improve this code?
let results = array
    .map { $0.path }
    .filter { $0.hasPrefix("/Documents") }
    .compactMap { $0.components(separatedBy: "/").last }
    .prefix(maxEntries)

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