You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have updated the existing onChange(of:, perform:) which is deprecated in v17 to onChange(of:, _ action:). Now ViewInspector doesn't recognize callOnChange reporting "does not have 'onChange' modifier"`. Here is an example of the error. How can I get these tests working again?
`
func testOnCall() throws {
struct TestView: View { @State var inputValue: String = "" @State var displayValue: String = ""
var body: some View {
VStack {
Text(displayValue)
TextField("Test Input", text: $inputValue)
}
.onChange(of: inputValue, { old, new in
displayValue = "Was (old.count > 0 ? old : "N/A") and now is (new.count > 0 ? new : "N/A")"
})
}
}
let test = TestView()
XCTAssertNoThrow(try test.inspect().callOnChange(newValue: "Bob"))
XCTAssertNoThrow(try test.inspect().vStack().callOnChange(newValue: "Bob"))
XCTAssertNoThrow(try test.inspect().find(ViewType.VStack.self).callOnChange(newValue: "Bob"))
}
`
The text was updated successfully, but these errors were encountered:
I added support for the new modifier with .callOnChange(oldValue:newValue:). I don't think there has been a release, so you may need to point to a branch or a commit after the feature was added.
I have updated the existing
onChange(of:, perform:)
which is deprecated in v17 toonChange(of:, _ action:). Now ViewInspector doesn't recognize callOnChange reporting
"does not have 'onChange' modifier"`. Here is an example of the error. How can I get these tests working again?`
func testOnCall() throws {
struct TestView: View {
@State var inputValue: String = ""
@State var displayValue: String = ""
var body: some View {
VStack {
Text(displayValue)
TextField("Test Input", text: $inputValue)
}
.onChange(of: inputValue, { old, new in
displayValue = "Was (old.count > 0 ? old : "N/A") and now is (new.count > 0 ? new : "N/A")"
})
}
}
`
The text was updated successfully, but these errors were encountered: