Migrate Preferences and Settings UI from ObjC to Swift/SwiftUI - #8
Merged
Conversation
Replace EMRPreferences (ObjC) with Preferences.swift, providing full @objc bridge methods so existing ObjC callers (EMRAppDelegate, EMRPopoverViewController) work unchanged. Add 31 Swift preference tests and fix test target header search path for Zooom3-Swift.h. All 112 tests pass.
Create SettingsView.swift replicating the popover UI in SwiftUI with modifier checkboxes, mouse button pickers, boolean toggles, conflict warning, and reset/quit buttons. Uses SettingsCallbacks struct for action wiring. Add 18 tests covering creation, callbacks, conflict detection, and static data. All 130 tests pass.
Swap EMRPopoverViewController for SettingsViewBridge (NSHostingController wrapping SwiftUI SettingsView). Add SettingsViewDelegate protocol so EMRAppDelegate receives callbacks for modifier/button/hover changes, reset, and quit. Remove all IBAction wiring code and the old ObjC popover files. All 101 tests pass.
Remove the Spacer() that caused the popover to expand beyond its content, and use NSHostingController.sizingOptions = .preferredContentSize to let the popover automatically match the SwiftUI view's intrinsic size. Fixes the gap at the top and clipped buttons at the bottom.
Replace EMRMoveResize.h/.m with MoveResize.swift. Extract C enum/struct types into ResizeTypes.h for shared ObjC/Swift access. AXUIElement memory management now uses Swift ARC instead of manual CFRetain/CFRelease. Update EMRAppDelegate and tests to use the new MoveResize class.
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
EMRPreferencesfrom Objective-C to a SwiftPreferencesclassSettingsViewwith full test coverageEMRPopoverViewControllerwith the SwiftUISettingsViewviaSettingsViewBridgeNSHostingController.sizingOptionsfor correct automatic content sizingTest plan
xcodebuild test)