Skip to content

Instantly share code, notes, and snippets.

@hermanbanken
Last active June 5, 2019 06:26
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