SwiftUI 开发脚手架含Tab List Navigation (2020年版)

SwiftUI 开发脚手架含Tab List Navigation (2020年版)

代码

import SwiftUI


struct ContentView: View {
    var body: some View {
        TabView {
            NavigationView {
                ComponentList()
            }
            .tabItem {
                Image(systemName: "rectangle.grid.1x2.fill")
                Text("Component")
            }.tag(0)
            
            
            NavigationView {
                Text("View Modification")
                    .navigationBarTitle("View Modification")
            }.tabItem {
                Image(systemName: "wrench.fill")
                Text("View Modification")
            }.tag(1)
        }
        .edgesIgnoringSafeArea(.top)
    }
}

struct ComponentList: View {
    var body: some View {
        List {
            Section(header: Text("User Interface")) {
                NavigationLink( destination: ViewAndControls()){
                    Text("  Views and Controls  ")
                        .bold(

你可能感兴趣的:(SwiftUI源码大全)