A SwiftUI preferences framework for iOS tweak development
PreferencesController.swift
class PreferencesController: NomaePreferencesController {
override var suiView: AnyView {
get { AnyView(RootPreferences()) }
set { super.suiView = newValue }
}
}
RootPreferences.swift
let identifier = "com.somedomain.sometweak"
struct RootPreferences: View {
@Preference("enabled", identifier: identifier) var enabled = true
var body: some View {
Form {
Toggle("Enabled", isOn: $enabled)
}
.navigationBarTitle("SomeTweak")
}
}
Link NomaePreferences in the Makefile
SomeTweak_FRAMEWORKS += NomaePreferences
Add NomaePreferences as a dependency in the control file
Depends: com.eamontracey.nomaepreferences
Huge thank you to Kabir for help debugging and fixing various Swift/Xcode problems