Last active
November 12, 2020 19:00
-
-
Save OskarGroth/43857077ecdbe770f57bb6c93cab7ad2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ObjA { | |
var isOn = false | |
} | |
struct ContentView: View { | |
// Because this is not an observed object, the UI in this view should theoretically never update | |
let obj = ObjA() | |
var body: some View { | |
print("Refreshed body") | |
return VStack { | |
Toggle("Test", isOn: Binding( | |
get: { obj.isOn }, | |
set: { | |
obj.isOn = $0 | |
} | |
)) | |
.toggleStyle(SwitchToggleStyle()) | |
Toggle("Test", isOn: Binding( | |
get: { obj.isOn }, | |
set: { | |
obj.isOn = $0 | |
} | |
)) | |
} | |
.padding(30) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment