Post

Replies

Boosts

Views

Activity

Reply to SwiftUI MenuBarExtra not updating when State changes
I worked around this by putting the MenuBarExtra into a struct: Scene and its content into a struct: View var body: some Scene { @State var state = AppState.shared MenuBar(state: state) } private struct MenuBar: Scene { @ObservedObject var state: AppState var body: some Scene { MenuBarExtra("App Name Here", image: state.logo) { MenuBarContent(state: state) } } } private struct MenuBarContent: View { @ObservedObject var state: AppState var body: some View { Text("App Name Here") if let browser = self.state.browser { Divider() Text("Running for \(browser.getDisplayName())") } Divider() Button("Chrome") { state.setBrowser(.chrome) } Button("Firefox") { state.setBrowser(.firefox) } Button("Quit") { NSApp.terminate(nil) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’24
Reply to Web Extensions's background page is missing in the Develop -> Web Extension Background Content menu in the latest Safari Technology Preview
I am still experiencing this issue. I need to be able to debug the background thread of my locally developed extension. Is there any workaround? MacOS Sequoia v15.1.1 Safari v18.1.1 Safari Technology Preview v18.2
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to SwiftUI MenuBarExtra not updating when State changes
I worked around this by putting the MenuBarExtra into a struct: Scene and its content into a struct: View var body: some Scene { @State var state = AppState.shared MenuBar(state: state) } private struct MenuBar: Scene { @ObservedObject var state: AppState var body: some Scene { MenuBarExtra("App Name Here", image: state.logo) { MenuBarContent(state: state) } } } private struct MenuBarContent: View { @ObservedObject var state: AppState var body: some View { Text("App Name Here") if let browser = self.state.browser { Divider() Text("Running for \(browser.getDisplayName())") } Divider() Button("Chrome") { state.setBrowser(.chrome) } Button("Firefox") { state.setBrowser(.firefox) } Button("Quit") { NSApp.terminate(nil) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Sep ’24