LavaUI docs

enum AppSettings

Swift

enum AppSettings

Cross-platform, file-backed key/value settings for LavaUI apps.

One JSON file per app under the platform config directory:

Platform Location
Linux ~/.config/<AppName>/settings.json (or $XDG_CONFIG_HOME)
macOS ~/Library/Application Support/<AppName>/settings.json
fallback temp dir / <AppName>/settings.json

Call configure(appName:) once at process start (before the first get/set), typically next to LavaApp.open. Keys are plain strings; values are JSON scalars or anything Codable. Writes are atomic and locked.

AppSettings.configure(appName: "LavaSpotify")
AppSettings.set("midnight-groove", forKey: "theme.id")
let id = AppSettings.string(forKey: "theme.id")

Not a replacement for secrets that need tighter permissioning — OAuth tokens should stay in their own 0600 file — but fine for theme, window layout, and other non-sensitive preferences.

Sources/LavaUI/AppSettings.swift:26

Properties

static var directoryURL: URL { get }

Directory that holds settings.json (created on first write).

Sources/LavaUI/AppSettings.swift:47

static var fileURL: URL { get }

Not documented.

Sources/LavaUI/AppSettings.swift:54

static var keys: [String] { get }

All keys currently stored (for diagnostics).

Sources/LavaUI/AppSettings.swift:180

Methods

static func bool(forKey key: String) -> Bool?

Not documented.

Sources/LavaUI/AppSettings.swift:82

static func configure(appName: String)

Sets the product name used for the config directory. Safe to call more than once; reloads from the new path.

Sources/LavaUI/AppSettings.swift:36

static func double(forKey key: String) -> Double?

Not documented.

Sources/LavaUI/AppSettings.swift:100

static func int(forKey key: String) -> Int?

Not documented.

Sources/LavaUI/AppSettings.swift:68

static func remove(_ key: String)

Not documented.

Sources/LavaUI/AppSettings.swift:163

static func removeAll()

Not documented.

Sources/LavaUI/AppSettings.swift:171

static func set(_ value: String, forKey key: String)

Not documented.

Sources/LavaUI/AppSettings.swift:64

static func set(_ value: Int, forKey key: String)

Not documented.

Sources/LavaUI/AppSettings.swift:78

static func set(_ value: Bool, forKey key: String)

Not documented.

Sources/LavaUI/AppSettings.swift:96

static func set(_ value: Double, forKey key: String)

Not documented.

Sources/LavaUI/AppSettings.swift:110

static func set<T>(_ value: T, forKey key: String) where T : Encodable

Not documented.

Sources/LavaUI/AppSettings.swift:138

static func string(forKey key: String) -> String?

Not documented.

Sources/LavaUI/AppSettings.swift:60

static func value<T>(forKey key: String, as type: T.Type) -> T? where T : Decodable

Not documented.

Sources/LavaUI/AppSettings.swift:116