The issue can be seen in the following playground. There are four published values that will be updated asynchronously (an image and three strings). When all four of them have been initialized or subsequently changed then the UI will need to be updated. When I try to capture this data flow using CombineLatest4 the compiler immediately objects to the fourth argument with the message Extra argument in call. (Note: the following code doesn't actually do anything since it only has a publisher, but it is sufficient to produce the error message in Playground).
import Combine import UIKit struct CustomerUpdates { @Published var photo: UIImage! @Published var firstName: String! @Published var lastName: String! @Published var id: String! typealias customerTuple = ( photo: UIImage, firstName: String, lastName: String, id: String ) var validatedCustomer: AnyPublisher< customerTuple, Never > { return Publishers.CombineLatest4( $photo, $firstName, $lastName, $id ) { photo, firstName, lastName, id in if photo == nil || firstName == nil || lastName == nil || id == nil { return nil } return ( photo!, firstName!, lastName!, id! ) } .compactMap .return( on: RunLoop.main ) } } My question is, why does the compiler flag the fourth argument (the "id")? Apple's documentation for the CombineLatest4 generic struct says:
A publisher that receives and combines the latest elements from four publishers.