Код: Выделить всё
struct MyTabView: View {
@State private var selectedTab = 0
var body: some View {
TabView(selection: $selectedTab) {
Tab("Home", systemImage: "house", value: 0) {
ZStack {
Rectangle().fill(Color.black).ignoresSafeArea()
VStack {
Text("Home")
}
}.ignoresSafeArea()
}
Tab("Profile", systemImage: "person", value: 1) {
Text("Profile")
}
Tab("Search", systemImage: "magnifyingglass", value: 2) {
Text("Search")
}
}
.tint(nil) // Doesn't work. My desired effect should not default to system blue
}
}
Код: Выделить всё
let appearance = UITabBarAppearance()
appearance.selectionIndicatorTintColor = nil
UITabBar.appearance().standardAppearance = appearance
UITabBar.appearance().scrollEdgeAppearance = appearance

Здесь я бы хотел, чтобы вкладка «Главная» также была белой, как и невыбранные вкладки, но сейчас по умолчанию она синего цвета.

Аналогично, я бы хотел, чтобы вкладка «Профиль» также была черной, как и невыбранные вкладки, но по умолчанию она синяя.
Подробнее здесь: https://stackoverflow.com/questions/798 ... selected-a
Мобильная версия