Comes with pre-made components: Toggle, Button, Slider, etc…
Style components with native SwiftUI modifiers.
Show and hide components dynamically.
Add your own custom SwiftUI views.
Works on iOS and macOS.
Installation
Setting is available via the Swift Package Manager. Requires iOS 15+ or macOS Monterey and up.
https://github.com/aheze/Setting
Usage
importSettingimportSwiftUIstructPlaygroundView: View {
/// Setting supports `@State`, `@AppStorage`, `@Published`, and more!@AppStorage("isOn") var isOn =truevar body: some View {
/// Start things off with `SettingStack`.
SettingStack {
/// This is the main settings page.SettingPage(title: "Playground") {
/// Use groups to group components together.SettingGroup(header: "Main Group") {
/// Use any of the pre-made components...SettingToggle(title: "This value is persisted!", isOn: $isOn)
/// ...or define your own ones!
SettingCustomView {
Image("Logo")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 160)
.padding(20)
}
/// Nest `SettingPage` inside other `SettingPage`s!SettingPage(title: "Advanced Settings") {
SettingText(title: "I show up on the next page!")
}
}
}
}
}
}