Programming in Swift: Functions & Types

Jan 4 2022 Swift 5.5, iOS 15, Xcode 13

Part 1: Functions

3. Challenge: Functions

Lesson Complete

Play Next Lesson
Next
Save for later
About this episode
See versions

See course reviews

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 2. Review Functions Next episode: 4. Overloading

Update Notes: This course was originally recorded in 2019. It has been reviewed and all content and materials updated as of October 2021.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

You can unlock the rest of this video course, and our entire catalogue of books and videos, with a kodeco.com Professional subscription.

How about a quick challenge to test everything we reviewed in the last episode? You’ll find one in the next page of the Playground for this part of the course. Pause the video, give it a try, and then come back to see what I did with it. Good luck!

func generateTwitterHandle(
(name: String, anotherWord word: String
String = "Meow"
 -> String {
 
 }
name.lowercased() + word
generateTwitterHandle("Ozma")
func deutschify(
func deutschify(_ word1: String, _ word2: String = "katzen")
func deutschify(_ word1: String, _ word2: String = "katzen") -> String {

}
...
  let adjective = ["Frölich", "Rund", "Salzig", "Schwarze"].randomElement()!
  let ending = ["schule", "keit", "maler", "maschine"].randomElement()!
}
...  
  return adjective + word1 + word2 + ending
}
deutschify("swifty")
deutschify("arctic", "tree")