-
[SwiftUI] NavigationStackSwift/SwiftUI 2023. 11. 26. 12:28
import SwiftUI struct ContentView: View { @State var destination: Destination? var body: some View { NavigationStack { Button("Append") { destination = .detail } .navigationDestination(item: $destination, destination: { destination in switch destination { case .detail: Color.green case .setting: Color.red } }) } } } enum Destination { case detail case setting } #Preview { ContentView() }
'Swift > SwiftUI' 카테고리의 다른 글
[SwiftUI] GlobalSpinner (0) 2023.12.05 [SwiftUI] EnvironmentObject 와 Environment 의 차이 (0) 2023.12.03 [SwiftUI] Pro Max landscape NavigationView bug (0) 2023.07.13 [SwiftUI] iPad, iPhone 대응하기 (0) 2023.07.09 StoreKit2 References (0) 2023.07.09