LNSettingsWindowController is an NSWindowController subclass that manages your custom view controllers for handling app settings.

LNPopupUI supports Swift tools versions 6.0 (Xcode 16) and above. In Xcode, click File -> Swift Packages -> Add Package Dependency, enter https://github.com/LeoNatan/LNSettingsWindowController. Select the version you’d like to use.
You can also manually add the package to your Package.swift file:
.package(url: "https://github.com/LeoNatan/LNSettingsWindowController", from: "1.0")And the dependency in your target:
.target(name: "BestExampleApp", dependencies: ["LNSettingsWindowController"]),Import the module in your project:
import LNSettingsWindowController// In AppDelegate:
let settingsController = LNSettingsWindowController()
@IBAction func showSettings(_ sender: Any) {
settingsController.showSettingsWindow()
}
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Set the view controllers to display
settingsController.viewControllers = [
// ...
]
}Settings controllers must be NSViewController subclasses, implementing the LNSettingsWindowControllerDataSource protocol:
class GeneralSettingsController: NSViewController, LNSettingsWindowControllerDataSource {
var settingsIdentifier: String {
"general"
}
var settingsTitle: String {
String(localized: "General")
}
var settingsToolbarIcon: NSImage {
NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
}
}Finally, connect the Settings… menu item to the showSettings(_:) method:
Originally based on CCNPreferencesWindowController 🙏
