Skip to content

Commit 4c3e936

Browse files
committed
Update view when value in text binding changes
1 parent 1fa4d3c commit 4c3e936

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

Sources/CodeEditSourceEditor/SourceEditor/SourceEditor.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ public struct SourceEditor: NSViewControllerRepresentable {
140140
} else {
141141
context.coordinator.isUpdatingFromRepresentable = true
142142
updateControllerWithState(state, controller: controller)
143+
switch text {
144+
case .storage:
145+
break
146+
case let .binding(text):
147+
if controller.text != text.wrappedValue {
148+
controller.text = text.wrappedValue
149+
}
150+
}
143151
context.coordinator.isUpdatingFromRepresentable = false
144152
}
145153

0 commit comments

Comments
 (0)