Skip to content

Instantly share code, notes, and snippets.

@sturdysturge
Created July 21, 2020 16:02
Show Gist options
  • Save sturdysturge/88fd21a83a1f50bc5834c7ce094fe2a3 to your computer and use it in GitHub Desktop.
Save sturdysturge/88fd21a83a1f50bc5834c7ce094fe2a3 to your computer and use it in GitHub Desktop.
RevDoc LabelAndTabIndexStyleView
import SwiftUI
@available(OSX, unavailable)
struct TabIndexStyleView: View {
@State private var selected = 1
var body: some View {
VStack {
TabView(selection: self.$selected) {
Label("\(selected)", systemImage: "gamecontroller")
.labelStyle(DefaultLabelStyle())
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
.tag(1)
Label("\(selected)", systemImage: "gamecontroller")
.labelStyle(IconOnlyLabelStyle())
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.green)
.tag(2)
Label("\(selected)", systemImage: "gamecontroller")
.labelStyle(TitleOnlyLabelStyle())
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.blue)
.tag(3)
}
.indexViewStyle(PageIndexViewStyle(backgroundDisplayMode: .always))
.tabViewStyle(PageTabViewStyle())
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment