DEV Community

Discussion on: SwiftUI By Examples

Collapse
 
patrickrche profile image
Patrick Roche

class RoomStore: ObservableObject {
var rooms: [Room] {
willSet { objectWillChange.send() }
}

init(rooms: [Room] = []) {
    self.rooms = rooms
}

let objectWillChange = PassthroughSubject()

}
_PassthroughSubject() Generic parameter 'Failure' could not be inferred

Why do I get this error?
Have imported Combine and SwiftUI

Collapse
 
zavrelj profile image
Jan Zavrel • Edited

Sorry for that typo! I didn't properly escape < and > characters so markdown omitted the whole content inside it, the correct code looks like this:
let objectWillChange = PassthroughSubject<Void, Never>()