Home > AI > Uncategorized

Merge

let germanCities = PassthroughSubject<String, Never>()
let italianCities = PassthroughSubject<String, Never>()
let europianCities = Publishers.Merge(germanCities, italianCities)

_ = europianCities.sink(receiveValue: { city in
    print("\(city) is a city in europe")
})

germanCities.send("Munich")
germanCities.send("Berlin")
italianCities.send("Milano")
italianCities.send("Rome")

What will this code print?

Related posts:

Leave a Reply