1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-15 06:40:32 +05:30
yattee/Model/SettingsModel.swift

29 lines
781 B
Swift
Raw Normal View History

import Foundation
import SwiftUI
2022-07-05 22:56:03 +05:30
final class SettingsModel: ObservableObject {
static var shared = SettingsModel()
@Published var presentingAlert = false
@Published var alert = Alert(title: Text("Error"))
2024-02-02 04:24:16 +05:30
@Published var presentingSettingsImportSheet = false
@Published var settingsImportURL: URL?
func presentAlert(title: String, message: String? = nil) {
let message = message.isNil ? nil : Text(message!)
alert = Alert(title: Text(title), message: message)
presentingAlert = true
}
func presentAlert(_ alert: Alert) {
self.alert = alert
presentingAlert = true
}
2024-02-02 04:24:16 +05:30
func presentSettingsImportSheet(_ url: URL) {
settingsImportURL = url
presentingSettingsImportSheet = true
}
}