Skip to content

Instantly share code, notes, and snippets.

@hasanalisiseci
Last active November 27, 2023 21:46
Show Gist options
  • Save hasanalisiseci/4b9537ed4228ab91c51af68e6c95818a to your computer and use it in GitHub Desktop.
Save hasanalisiseci/4b9537ed4228ab91c51af68e6c95818a to your computer and use it in GitHub Desktop.
struct QuickActionsView: View {
@State var navigationValue: Int? = nil
@StateObject var qaManager = QuickActionsManager.instance
@Environment(\.scenePhase) var phase
var body: some View {
VStack {
Text("Quick Actions").font(.largeTitle).bold()
NavigationLink(tag: 1, selection: $navigationValue) {
Text("Search QA")
.font(.largeTitle).bold()
} label: {
EmptyView()
}
NavigationLink(tag: 2, selection: $navigationValue) {
Text("Home QA")
.font(.largeTitle).bold()
} label: {
EmptyView()
}
}.padding()
.onChange(of: qaManager.quickAction) { _, _ in
handleQAData()
}
.onAppear {
handleQAData()
}
}
private func handleQAData() {
if qaManager.quickAction == .home {
navigationValue = 2
} else if qaManager.quickAction == .search {
navigationValue = 1
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment