diff --git a/Sources/Adwaita/Model/User Interface/App/App.swift b/Sources/Adwaita/Model/User Interface/App/App.swift index 61077e8..7528846 100644 --- a/Sources/Adwaita/Model/User Interface/App/App.swift +++ b/Sources/Adwaita/Model/User Interface/App/App.swift @@ -24,7 +24,8 @@ public protocol App { /// The app's application ID. - var id: String { get } + static var id: String { get } + /// The app's windows. @SceneBuilder var scene: Scene { get } // swiftlint:disable implicitly_unwrapped_optional @@ -39,8 +40,12 @@ public protocol App { extension App { + @available(*, deprecated, message: "The 'id' property is removed. Please use the new static id instead.") + var id: String { Self.id } + /// The application's entry point. public static func main() { + GTUIApp.appID = Self.id let app = setupApp() app.run() } @@ -50,7 +55,7 @@ extension App { /// To run the app, call the ``GTUIApp/run(automaticSetup:manualSetup:)`` function. public static func setupApp() -> GTUIApp { var appInstance = self.init() - appInstance.app = GTUIApp(appInstance.id) { appInstance } + appInstance.app = GTUIApp(Self.id) { appInstance } GTUIApp.updateHandlers.append { force in var removeIndices: [Int] = [] for (index, window) in appInstance.app.sceneStorage.enumerated() { @@ -64,7 +69,6 @@ extension App { appInstance.app.sceneStorage.remove(at: index) } } - GTUIApp.appID = appInstance.id return appInstance.app } diff --git a/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift b/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift index 3fc9530..5ae3c10 100644 --- a/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift +++ b/Sources/Adwaita/Model/User Interface/App/GTUIApp.swift @@ -13,8 +13,7 @@ public class GTUIApp { /// The handlers which are called when a state changes. static var updateHandlers: [(Bool) -> Void] = [] /// The app's id for the file name for storing the data. - static var appID = "temporary" - + static var appID: String! /// The pointer to the application. public var pointer: UnsafeMutablePointer? /// Fields for additional information.