-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
Hi. I want to add this card to my application. I'm doing it like I do with a normal .sheet, but I don't know why it is creating cards like on an infinite loop.
Main view code:
@StateObject private var captureViewModel = CaptureViewModel()
var body: some View {
let filteredList = accounts.filter() {
if codesViewModel.searchText == "" {
return true
}
guard let item = $0.name else { return false }
return item.lowercased().contains(codesViewModel.searchText.lowercased())
}
NavigationView {
Group {
...
}
.toolbar(content: {
ToolbarItem(placement: .topBarTrailing) {
HStack {
Menu {
if (!ProcessInfo.processInfo.isMacCatalystApp) {
Button {
captureViewModel.sheetOpen.toggle() // Opens the slide over card (previously it was a sheet)
} label: {
Label("Capture QR code", systemImage: "qrcode.viewfinder")
}
}
...
} label: {
Image(systemName: "plus")
}
}
}
})
.slideOverCard(isPresented: $captureViewModel.sheetOpen) {
CaptureView(captureViewModel: captureViewModel)
}
.sheet(isPresented: $newAccountFormViewModel.sheetOpen, content: {
NewAccountFormViewIos(newAccountFormViewModel: newAccountFormViewModel)
})
.preferredColorScheme(appConfig.theme)
}
.navigationViewStyle(StackNavigationViewStyle())
}The slide over view:
var body: some View {
Group {
...
}
.frame(height: 300)
.onAppear(perform: {
...
})
}chichkanov
Metadata
Metadata
Assignees
Labels
No labels
