stackotter / swift-cross-ui

A cross-platform declarative UI framework, inspired by SwiftUI.
https://stackotter.github.io/swift-cross-ui/documentation/swiftcrossui/
MIT License
652 stars 36 forks source link

Get rid of `identifier` requirement of `App` protocol #89

Closed stackotter closed 2 months ago

stackotter commented 7 months ago

The identifier property is only used by Gtk so I reckon GtkBackend should just use a default value and provide some way to configure it. Alternatively, we could just provide a default implementation of the identifier property which has some default identifier such as com.example.Example (not sure what a good default would be).

warmachinesocial commented 4 months ago

Did you mean this under GtkBackend.swift


    public typealias Window = Gtk.Window
    public typealias Widget = Gtk.Widget

    var gtkApp: Application

    /// A window to be returned on the next call to ``GtkBackend/createWindow``.
    /// This is necessary because Gtk creates a root window no matter what, and
    /// this needs to be returned on the first call to `createWindow`.
    var precreatedWindow: Window?

    public init(appIdentifier: String) {
        gtkApp = Application(applicationId: appIdentifier)
    }
stackotter commented 4 months ago

Yeah, that initialiser is currently the only piece of code that actually uses the appIdentifier for anything, the other backends just ignore it, so it should be a gtk specific setting instead of a setting provided to all backends.

stackotter commented 2 months ago

Completed this on the layout_system branch a little while ago.