Update the preferences window to SwiftUI - #880
Conversation
- 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.
There was a problem hiding this comment.
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.
…input source retrieval
|
Thank you for rewriting the preferences window in SwiftUI! While trying it out, I noticed a couple of minor UI issues:
I also made a few UI refinements on top of your PR (based on 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
left a comment
There was a problem hiding this comment.
LGTM. Thank you both for modernizing and improving this crucial part of the input method!
|
@zonble There are merge confilcts. PTAL. |




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