39: Breakpoint Breadcrumbs
Code Completion - A podcast by Code Completion
Categories:
Welcome to Code Completion, Episode 39! 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: Code Completion Club: https://codecompletion.io/jointheclub Indie App Spotlight, with two apps for you to check out: SongKit by Thomas Grapperon (@tgrapperon): https://songkit.app Minimal by Arthur Van Siclen (@arthurofbabylon): https://minimal.app Debugging Discussion View Debugging Reveal: https://revealapp.com Console Commands: v, p, po The usefulness of print debugging Breakpoints Parallel Universes: https://www.youtube.com/watch?v=kpk2tdsPh0A os_signpost and logging 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: Fernando Olivares Spencer Curtis Dimitri Bouniol 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 Weekly Swift Exercises. Go to https://mailchi.mp/hey/weekly-swift-exercise-signup today to subscribe! 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! Compiler Error This week's Compiler Error has a theme: Error Handling! 1 - NSError supports built-in error recovery through the use of a recovery attempter, allowing the origin of the error a chance to handle things like retries when delivered to an NSAlert. 2 - A custom Swift Error type can provide localized description information by conforming to LocalizedError and overriding localizedDescription. 3 - Although it isn’t possible to specify the type of Error thrown from a method in Swift, it is possible to restrict the error type when it is delivered within a Result. 4 - It is possible to omit localized descriptions and failure reasons when creating an NSError while still making this information available to consumers of the error by creating a userInfo provider for the error domain.