|
NOTE: This query contains a spoiler for the Day 9 so do not proceed if you haven't finished the challenge. I just finished the Day 9 challenge and worked through the solution video. I was a bit stumped because even though Paul works through
So this leaves me asking a couple questions:
It's helpful to know that I can do these things now, but I'd like to know that I'm a bit more capable before tackling the challenge. Feedback is welcome. |
|
I just finished day 9 and I also didn't think of that. My code did assigned temporarry variables
I don't think you should feel dissapointed, becuase this ckecpoitns are supposed to be based on knowledge we already have, and he hadn't taught that. I wouldn't have come with that soultion either. And tbh I had a really hard time coming with my soultion in the first place because he doesn't really explain map and sorted very well. EDIT: He did mentioned how to chained them in the hints. |
|
@burr asks
He provided this technique in the HINTS section of Checkpoint 5.
By the way, you're not chaining methods to the end of closures. You're chaining a method to a type!
|
|
I wish i could find the video. I think it was in one of @twoStraws' older Swift on Sundays episode. In anycase, @twoStraws was challenged by a viewer as to why he didn't just jump straight to the "correct way" for coding something or other. @twoStraws encouraged the viewer to read about "Wittgenstein's ladder" See -> Wiki: Wittgenstein's ladder In short, @twoStraws notes it's sometimes necessary to climb a ladder to gain a certain vantage point. Once the understanding is clear, you can destroy the ladder and never climb it again. You can see there are alternate paths to the same point. However, you may not appreciate the alternative paths without first having climbed that initial ladder. Also, it's time to build a new ladder and go higher. @twoStraws does this in many of his videos. If you code along, you'll eventually find yourself erasing everything you just spent 27 minutes building. This is done for a very good reason. Follow along with the program! In Challenge 5, it's perfectly cromulent to solve the exercise as @Toro demonstrated. But once you've seen that path to the answer, you'll appreciate how elegant chaining methods is! You just had the ladder knocked out from under you. So now you'll be more alert to future code snips where this is very common. Keep Coding! |
|
You might also see them on separate line but this is fact the same as adding to the end to end. I can be easier to read but no-one will tell you!
You will see this alot in SwiftUI, Combine framework, etc |
|
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.