Does Apple publish SwiftUI documentation in a format that can be consumed offline (epub, pdf or similar)?
Post
Replies
Boosts
Views
Activity
I have the following conceptual code:
import SwiftUI
@main
struct SwiftBarApp: App {
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
ContentView()
}
ForEach(appDelegate.menuItems, id:\.self) { menuItemSet in
MenuBarExtra("Title") {
MenuBarView(menuItemSet: menuItemSet)
}
}
}
I am attempting to create multiple menu bar items using MenuBarExtra, based upon the content of appDelegate.menuItems. Clearly, my approach does not work as ForEach is supported on Views and not Scenes.
Is there an alternate approach that would allow me to have a variable number of menu bar icons?