mirror of
				https://github.com/yattee/yattee.git
				synced 2025-10-31 12:41:57 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			546 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			546 B
		
	
	
	
		
			Swift
		
	
	
	
	
	
| import Foundation
 | |
| import SwiftUI
 | |
| 
 | |
| final class SettingsModel: ObservableObject {
 | |
|     static var shared = SettingsModel()
 | |
| 
 | |
|     @Published var presentingAlert = false
 | |
|     @Published var alert = Alert(title: Text("Error"))
 | |
| 
 | |
|     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
 | |
|     }
 | |
| }
 | 
