feat: replace editor right pane with SwiftUI content area#236
Open
feat: replace editor right pane with SwiftUI content area#236
Conversation
Replace the XIB-bound right pane (HostsTextView + NSPredicateEditor) with SwiftUI views while keeping the Editor.xib window shell intact. New files: - HostsTextViewRepresentable: NSViewRepresentable wrapping HostsTextView with bidirectional content sync and syntax highlighting preference - CombinedHostsPickerView: SwiftUI toggle list replacing NSPredicateEditor for selecting which hosts files to combine - ContentView: Composes picker (for CombinedHosts) + text editor - ContentInstaller: @objc bridge installing SwiftUI into XIB split view Changes: - HostsTextView: Add createForProgrammaticUse factory method, extract setupColors from initWithCoder for reuse - EditorController: Call ContentInstaller after SidebarInstaller - Bridging header: Add HostsTextView.h import - Xcode project: Add 4 new Swift source files The old controllers (HostsTextController, CombinedHostsPredicateController, CombinedHostsPredicateEditorRowTemplate) remain XIB-instantiated but their views are detached from the hierarchy. Deferred to PR 3 for deletion. This is PR 2 of 3 in the Editor.xib modernization plan.
…dHostsPickerView - Unwrap optional return from HostsTextView.createForProgrammaticUse (ObjC factory methods return nullable in Swift) - Add @ViewBuilder to pickerContent(for:) to fix opaque return type inference with local let bindings
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
HostsTextViewRepresentablewrapping the existing HostsTextView viaNSViewRepresentablewith bidirectional content syncCombinedHostsPickerViewas a SwiftUI toggle list replacing the complexNSPredicateEditorfor combined hosts file selectionContentViewcomposing the picker + text editor, andContentInstalleras the@objcbridgeThis is PR 2 of 3 in the Editor.xib modernization plan. PR 1 was #234 (sidebar). PR 3 will eliminate Editor.xib entirely.
Changes
New Swift Files
HostsTextViewRepresentable.swiftNSViewRepresentablewrappingHostsTextViewwith content sync, syntax highlighting preference via@AppStorage, and@MainActorcoordinatorCombinedHostsPickerView.swiftCombinedHostsfile is selectedContentView.swiftVStackContentInstaller.swift@objcbridge that replaces the right pane of the XIB split view withNSHostingViewModified Files
HostsTextView.h/.m+createForProgrammaticUsefactory method; extractsetupColorsfrominitWithCoder:EditorController.m[ContentInstaller installIn:splitView]afterSidebarInstallerGasMask-Bridging-Header.h#import "HostsTextView.h"project.pbxprojSuperseded (kept alive, deferred to PR 3)
HostsTextController— XIB-instantiated, bindings fire on detached view (harmless)CombinedHostsPredicateController+CombinedHostsPredicateEditorRowTemplate— sameTest plan