I’m new to SwiftUI. I know the hstack is the horizontal layout , but why it show vertical in this case ?
@SceneBuilder
private func menuBarExtra() -> some Scene {
if #available(macOS 13.0, *) {
MenuBarExtra(isInserted: $statusMenu){
AppMenu()
} label: {
let image: NSImage = {
let ratio = $0.size.height / $0.size.width
$0.size.height = 18
$0.size.width = 18 / ratio
return $0
}(NSImage(named: "Finder")!)
Image(nsImage: image)
}
}
struct AppMenu: View {
var body: some View {
HStack{
Text("1")
Text("2")
Text("3")
}
}
}
Macos Menu bar application :
enter image description here
How can i customize layout in MenuBarExtra ?
How can i customize layout in MenuBarExtra ?
New contributor
InfyniClick is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.