Skip to content

Update the preferences window to SwiftUI - #880

Merged
lukhnos merged 7 commits into
openvanilla:masterfrom
zonble:prefs
Jul 16, 2026
Merged

Update the preferences window to SwiftUI#880
lukhnos merged 7 commits into
openvanilla:masterfrom
zonble:prefs

Conversation

@zonble

@zonble zonble commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

The PR use Siwft UI to implement the preferences and rmoved the legacy one.

zonble added 4 commits July 11, 2026 22:03
- Updated preferences.xib to use the latest tools version and plugin version.
- Changed the InputMethodServerPreferencesWindowControllerClass in Info.plist to PreferencesUiWindowController.
- Migrated strings related to the preferences window from preferences.xib to Localizable.strings for both English and Traditional Chinese.
- Introduced PreferencesModel.swift to manage preferences logic and data binding.
- Created PreferencesUiWindowController.swift to handle the preferences window lifecycle and UI.
- Developed PreferencesView.swift to structure the preferences UI with tabs for Basic, User Phrases, and Advanced settings.
- Implemented various UI components for user interaction in preferences, including toggles, pickers, and text fields.
- Enhanced user experience by allowing folder selection for user phrases and providing system report generation functionality.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates the preferences user interface from a legacy Cocoa XIB-based layout to a modern SwiftUI implementation, introducing PreferencesView, PreferencesViewModel, and a new PreferencesWindowController under Source/PreferencesUI. The old preferences.xib and its localized variants have been removed, with their strings migrated to Localizable.strings. A critical issue was identified in PreferencesModel.swift where calling takeRetainedValue() directly on the result of TISCreateInputSourceList could cause a runtime crash if it returns nil; a suggestion was made to safely handle this with optional chaining.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Source/PreferencesUI/PreferencesModel.swift Outdated
@ChiahongHong

ChiahongHong commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Thank you for rewriting the preferences window in SwiftUI! While trying it out, I noticed a couple of minor UI issues:

  1. radio buttons appeared to be custom controls rather than native macOS radio buttons
  2. 產生系統資訊報告 button had a dark background in light theme

I also made a few UI refinements on top of your PR (based on 2aa70a0), available in my prefs branch: https://github.com/ChiahongHong/McBopomofo/tree/prefs

The underlying architecture and functionality remain entirely based on your implementation, while my changes mainly focus on the visual presentation and interactions. Since my understanding of Swift is still fairly limited, I used AI assistance for parts of these changes. Please feel free to take a look and see whether you think these changes make the UI clearer.

Thank you again for taking this on and helping us move away from maintaining the XIB 🚀

@lukhnos lukhnos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you both for modernizing and improving this crucial part of the input method!

@lukhnos

lukhnos commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

@zonble There are merge confilcts. PTAL.

@lukhnos
lukhnos merged commit 2480b52 into openvanilla:master Jul 16, 2026
7 checks passed
@zonble
zonble deleted the prefs branch July 17, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants