14 lines
351 B
Swift
14 lines
351 B
Swift
import SwiftUI
|
|
|
|
@MainActor
|
|
extension AppSettingsController {
|
|
func binding<Value>(_ keyPath: WritableKeyPath<AppSettings, Value>) -> Binding<Value> {
|
|
Binding(
|
|
get: { self.settings[keyPath: keyPath] },
|
|
set: { newValue in
|
|
self.update { $0[keyPath: keyPath] = newValue }
|
|
}
|
|
)
|
|
}
|
|
}
|