Skip to content

Instantly share code, notes, and snippets.

@samhenrigold
Created February 20, 2026 03:01
Show Gist options
  • Select an option

  • Save samhenrigold/c568bf21948c4eea69f4989417289f6e to your computer and use it in GitHub Desktop.

Select an option

Save samhenrigold/c568bf21948c4eea69f4989417289f6e to your computer and use it in GitHub Desktop.
SwiftUI segmented control rendering bug
//
// ContentView.swift
// toolbar-picker-bug
//
// Created by Sam on 2026-02-19.
//
import SwiftUI
struct ContentView: View {
@State private var tabSelection: Int = 0
let colors: [Color] = [.indigo, .white, .black, .gray]
var body: some View {
NavigationStack {
ScrollView {
ForEach(colors, id: \.self) { color in
color
.containerRelativeFrame(.vertical)
}
}
.toolbar {
ToolbarItem {
Picker("Tab", selection: $tabSelection) {
Label("First", systemImage: "square.and.arrow.up")
.tag(0)
Label("Second", systemImage: "folder")
.tag(1)
}
.pickerStyle(.segmented)
}
.sharedBackgroundVisibility(.hidden)
}
}
}
}
#Preview {
ContentView()
}
@samhenrigold
Copy link
Author

CleanShot.2026-02-19.at.21.53.10.mp4
CleanShot.2026-02-19.at.21.36.48.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment