Created
August 3, 2020 22:18
-
-
Save oocoocococo/03f34d21f54af74d906c78f1cc96d992 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
import SwiftUI | |
struct ContentView: View { | |
@State private var selection: Tab = .circle | |
var body: some View { | |
TabView(selection: $selection) { | |
Text("丸のビュー") | |
.tabItem { | |
Image(systemName: selection == .circle ? "circle.fill" : "circle") | |
.imageScale(.large) | |
.font(.system(size: 17.0)) // 文字サイズが変わらないようにする | |
.accessibility(label: Text("丸")) // アクセシビリティラベルをつける | |
Text("丸のタブ") | |
} | |
.tag(Tab.circle) | |
Text("三角のビュー") | |
.tabItem { | |
Image(systemName: selection == .triangle ? "triangle.fill" : "triangle") | |
.imageScale(.large) | |
.font(.system(size: 17.0)) // 文字サイズが変わらないようにする | |
.accessibility(label: Text("三角")) // アクセシビリティラベルをつける | |
Text("三角のタブ") | |
} | |
.tag(Tab.triangle) | |
} | |
} | |
} | |
extension ContentView { | |
enum Tab { | |
case circle | |
case triangle | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment