Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Migrate to SwiftUI and deprecate Main.storyboard #111

Open
tido64 opened this issue Jun 11, 2020 · 1 comment
Open

macOS: Migrate to SwiftUI and deprecate Main.storyboard #111

tido64 opened this issue Jun 11, 2020 · 1 comment
Labels
good first issue Good for newcomers platform: macOS This affects macOS

Comments

@tido64
Copy link
Member

tido64 commented Jun 11, 2020

It seems like a better idea to either hookup the window from the nib/storyboard to the AppDelegate; or, if the nib/storyboard doesn’t do anything of interest, just remove the window from there and create it programmatically instead.

Originally posted by @alloy in #104

@tido64
Copy link
Member Author

tido64 commented Oct 30, 2023

We will likely migrate to SwiftUI and deprecate Main.storyboard entirely. This will require us to bump the macOS deployment target to 11.0+. At the moment, we're stuck on 10.15 so we're looking at 4.0 release at the earliest.

In any case, I did some preliminary investigation and it looks like we no longer need to declare the default menu items. The code below will correctly insert the React menu between View and Window:

import SwiftUI

@main
struct ReactTestApp: App {
    @State private var rememberLastComponent = false

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        .commands {
            CommandMenu(LocalizedStringKey(stringLiteral: "React")) {
                Button(LocalizedStringKey(stringLiteral: "Load Embedded JS Bundle")) {
                    // TODO
                }
                Button(LocalizedStringKey(stringLiteral: "Load From Dev Server")) {
                    // TODO
                }
                Toggle(LocalizedStringKey(stringLiteral: "Remember Last Opened Component"), isOn: $rememberLastComponent)
                Divider()
            }
        }
    }
}

@tido64 tido64 changed the title Hook up the window from the storyboard to the AppDelegate macOS: Migrate to SwiftUI and deprecate Main.storyboard Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers platform: macOS This affects macOS
Projects
None yet
Development

No branches or pull requests

2 participants