Last active
November 27, 2023 21:46
-
-
Save hasanalisiseci/4b9537ed4228ab91c51af68e6c95818a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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