Skip to content

SwiftUI Binding Cache#9

Open
weilikuo wants to merge 2 commits intomasterfrom
feature/swiftUI-binding-cache
Open

SwiftUI Binding Cache#9
weilikuo wants to merge 2 commits intomasterfrom
feature/swiftUI-binding-cache

Conversation

@weilikuo
Copy link
Member

@weilikuo weilikuo commented Oct 23, 2022

DESCRIPTION

SwiftUI bindings built using Combiner.State as backing storage often don't update fast enough for SwiftUI, due to the full action + mutation cycle required for writes to State to take effect. This causes some SwiftUI elements to behave abnormally, such as TextEditor(text: Binding<String>), which seem to require instantaneous updates to the bound value.

This PR updates binding(action:getter:) to return a locally cached value immediately to SwiftUI, circumventing the issue described above. This "cache" is roughly analogous to the high-speed memory buffer on a slower spinning HDD storage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant