I am new to SwiftUI,I tried to put the extra code into the function, but I get some error message and I don't know how to fix:
'some' types are only implemented for the declared type of properties and subscripts and the return type of functions
My code:
func test() -> ToolbarItem<Void, some View> {
return ToolbarItem(direction: .right) {
Label("", systemImage: "icloud.and.arrow.up.fill")
.foregroundColor(.white)
.frame(width: itemWith, height: 30, alignment: .center)
}
}
Does anyone know how to do this? thank you
@ToolbarContentBuilder
func toolbars() -> some ToolbarContent {
ToolbarItem(placement: .navigationBarLeading) {
Button {
} label: {
Image(systemName: "chevron.left")
}
}
ToolbarItem(placement: .navigationBarTrailing) {
Button {
} label: {
Image(systemName: "camera.fill")
}
}
}
ToolbarContentBuilder Constructs a toolbar item set from multi-expression closures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With