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

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

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.

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