Reactive Programming in iOS with Combine

Feb 4 2021 · Swift 5.3, macOS 11.0, Xcode 12.2

Part 2: Transforming & Filtering Operators

09. Challenge: Create a Phone Number Lookup

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 08. More Transforming Operators Next episode: 10. Filtering Operators

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Heads up... You’re accessing parts of this content for free, with some sections shown as obfuscated text.

Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.

Unlock now

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)")
}