Creating setting bundles for iOS applications is usually a pain, and involves fiddly .plist
files. This becomes difficult for large projects requiring many pages of settings integrated into the system settings app.
To solve this issue, I creates SettingsBundleBuilder
which uses a result builder/SwiftUI-style syntax to generate the .plist
files for you. This makes it significantly easier to create, read and maintain complex setting bundles, like below:
import SettingsBundleBuilder
makeSettingsBundle {
Group("Main settings:") {
TextField("Name", key: "username")
MultiValue(
"Background music",
key: "background_music",
defaultValue: "ocean",
possibleValues: ["ocean", "forest", "city", "cafe", "river"],
readableVersions: ["Ocean", "Forest", "Bustling city", "Quiet cafe", "Gentle stream"]
)
}
RadioGroup(
"Color scheme:",
key: "color_scheme",
defaultValue: "blue",
possibleValues: ["blue", "red", "green"],
readableVersions: ["Blue", "Red", "Green"]
)
Group("Info") {
Text("App name", constantValue: "My app")
Text("App version", key: "version", defaultValue: "1.0.0")
Page("Advanced") {
Toggle("Experimental features", key: "experimental_features", defaultValue: false)
Slider(key: "opacity", defaultValue: 50.0, min: 0.0, max: 100.0)
}
}
}
You can view this project on GitHub.