Reactive Programming in iOS with Combine

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

Part 4: Timing, Scheduling and Sequencing Operators

29. Challenge: Sequence Operators

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: 28. Sequencing Operators Next episode: 30. Conclusion

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've reached locked video content where the transcript will be shown as obfuscated text.

How’s your golf range? Everyone wants to get par, but more often than not you’re under, or even worse, over par. In this challenge, you’ll summarize a golf player’s range at a given point in the match, which is dictated by the number of current scores.

var min: Int = 0
var max: Int = 0
var count: Int = 0

scores
    .print("publisher")
    .min()
    .sink {
    	min = $0
    }

scores
    .print("publisher")
    .max()
    .sink {
    	max = $0
    }

scores
    .print("publisher")
    .count()
    .sink {
    	count = $0
    }

print("You have golfed \(count) holes, with a min of \(min) and a max of \(max), with an average course par of 4.")