Post

Replies

Boosts

Views

Activity

Reply to Guided Project-Apple Pie: How to use map method in place of loop?
var letters = currentGame.formattedWord.map { String($0) } Another way of writing that is var letters = currentGame.formattedWord.map { letter in return String(letter) } We're essentially taking each character ('letter') from formattedWord and initializing a String from that letter using String(letter) and by using the closure on map, we're creating a whole new String array that gets passed into letters. The first solution is just a short-hand syntax for the second one. I recommend looking into closures and array operations.
Topic: Business & Education SubTopic: General Tags:
Jul ’21
Reply to Guided Project – Restaurant, Images don'r display
I get the same bug
Replies
Boosts
Views
Activity
Jul ’21
Reply to Guided Project-Apple Pie: How to use map method in place of loop?
var letters = currentGame.formattedWord.map { String($0) } Another way of writing that is var letters = currentGame.formattedWord.map { letter in return String(letter) } We're essentially taking each character ('letter') from formattedWord and initializing a String from that letter using String(letter) and by using the closure on map, we're creating a whole new String array that gets passed into letters. The first solution is just a short-hand syntax for the second one. I recommend looking into closures and array operations.
Topic: Business & Education SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’21