Skip to content

Commit ccead3f

Browse files
committed
Ensure Coordinators' Lifetime is Equal To The Editor's
1 parent 99779fa commit ccead3f

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

Sources/CodeEditSourceEditor/Controller/TextViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ public class TextViewController: NSViewController {
230230
coordinators.forEach {
231231
$0.prepareCoordinator(controller: self)
232232
}
233+
self.textCoordinators = coordinators.map { WeakCoordinator($0) }
233234
}
234235

235236
required init?(coder: NSCoder) {

Sources/CodeEditSourceEditor/SourceEditor/SourceEditor.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ public struct SourceEditor: NSViewControllerRepresentable {
128128
context.coordinator.isUpdateFromTextView = false
129129
}
130130

131-
// Set this no matter what to avoid having to compare object pointers.
132-
controller.textCoordinators = coordinators.map { WeakCoordinator($0) }
133-
134131
// Do manual diffing to reduce the amount of reloads.
135132
// This helps a lot in view performance, as it otherwise gets triggered on each environment change.
136133
guard !paramsAreEqual(controller: controller, coordinator: context.coordinator) else {

0 commit comments

Comments
 (0)