Skip to content

Ensure Coordinator's Lifetime is Equal To The Editor's #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ public class TextViewController: NSViewController {
coordinators.forEach {
$0.prepareCoordinator(controller: self)
}
self.textCoordinators = coordinators.map { WeakCoordinator($0) }
}

required init?(coder: NSCoder) {
Expand Down
3 changes: 0 additions & 3 deletions Sources/CodeEditSourceEditor/SourceEditor/SourceEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ public struct SourceEditor: NSViewControllerRepresentable {
context.coordinator.isUpdatingFromRepresentable = false
}

// Set this no matter what to avoid having to compare object pointers.
controller.textCoordinators = coordinators.map { WeakCoordinator($0) }

// Do manual diffing to reduce the amount of reloads.
// This helps a lot in view performance, as it otherwise gets triggered on each environment change.
guard !paramsAreEqual(controller: controller, coordinator: context.coordinator) else {
Expand Down