Last active
June 5, 2019 06:26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func run () { | |
if #available(iOS 13.0, *) { | |
// Create | |
let p1 = Publishers.Empty<Int, Error>() | |
let p2 = Publishers.Just(42) | |
let p3 = Publishers.Sequence<[Int], Error>(sequence: [1,2,3,4]) | |
// Operators | |
let p4 = p1 | |
.merge(with: p2) | |
.append(5) // add 5 to the end of the sequence | |
.allSatisfy { $0 >= 1 } // check if all values are bigger than 0 | |
.count() // how many values: 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment