When I embedded a PhotosPickerView() in popover,
it won't works:
struct PhotoPickerTest: View {
@State private var selectedPhotoItem: PhotosPickerItem?
@State var isTaped: Bool = false
var body: some View {
Button("", systemImage: "plus") {
isTaped = true
}
.popover(isPresented: $isTaped) {
PhotoPickerView()
}
}
func PhotoPickerView() -> some View {
PhotosPicker(selection: $selectedPhotoItem) {
Image(systemName: "photo")
}
}
}
but if I just replace "popover" to "sheet", it works fine:
struct PhotoPickerTest: View {
@State private var selectedPhotoItem: PhotosPickerItem?
@State var isTaped: Bool = false
var body: some View {
Button("", systemImage: "plus") {
isTaped = true
}
.sheet(isPresented: $isTaped) {
PhotoPickerView()
}
}
func PhotoPickerView() -> some View {
PhotosPicker(selection: $selectedPhotoItem) {
Image(systemName: "photo")
}
}
}
I think it's a bug, and bothered me a lot, hope apple engineers can fix it.