How to use TabView with enum in SwiftUI

Issue #599

Specify tag

enum Authentication: Int, Codable {
    case key
    case certificate
}


TabView(selection: $authentication) {
    KeyAuthenticationView()
        .tabItem {
            Text("πŸ”‘ Key")
        }
        .tag(Authentication.key)
    CertificateAuthenticationView()
        .tabItem {
            Text("πŸ“° Certificate")
        }
        .tag(Authentication.certificate)
}
Written by

I’m open source contributor, writer, speaker and product maker.

Start the conversation