[ad_1]
I am having a little bit of an advanced development and have bother determining how you can get it working:
class Father or mother : Codable, ObservableObject {
@Printed public var kids: [Child]
public func getChildren(with identify: String) -> [Child] {
return kids.filter { $0.identify == identify }
}
}
class Youngster : Codable, Hashable, ObservableObject {
static func == (lhs: Youngster, rhs: Youngster) -> Bool {
return lhs.identify == rhs.identify && lhs.isSomething == rhs.isSomething
}
func hash(into hasher: inout Hasher) {
hasher.mix(identify)
hasher.mix(isSomething)
}
let identify: String
@Printed var isSomething: Bool
}
...
struct MyView : View {
@ObservedObject var mother or father: Father or mother
var identify: String
var physique: some View {
ForEach(mother or father.getChildren(with: identify), id: .self) { baby in
Toggle(isOn: baby.$isSomething) { <== ERROR HERE
...
}
}
}
}
How do I resolve this?
(BTW, I used this to permit an ObservableObject class to be Codable. Though this appears unrelated, I’ve let this into my code extraction above as a result of maybe it issues.)
[ad_2]
