Reactive Programming in iOS with Combine

Feb 4 2021 Swift 5.3, macOS 11.0, Xcode 12.2

Part 2: Transforming & Filtering Operators

9. Challenge: Create a Phone Number Lookup

Lesson Complete

Play Next Lesson
Next
Save for later
About this episode

See course reviews

See forum comments
Cinema mode Mark as Complete Download course materials
Previous episode: 8. More Transforming Operators Next episode: 10. Filtering Operators

This video was last updated on Feb 4 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.

OK, that was a lot of information about Transforming Operators, so I’ve got a challenge for you before moving on. For this challenge, you need to create a publisher that does 2 things: receive a string of ten numbers or letters, and look up those numbers in a contacts data structure.

input
  .map(convert)
.replaceNil(with: 0)
.collect(10)
.map(format)
.map(dial)
.sink(receiveValue: { print($0) })
"0!1234567".forEach {
input.send(String($0))
}
  
"4085554321".forEach {
input.send(String($0))
}
  
"A1BJKLDGEH".forEach {
input.send("\($0)")
}