Skip to content
Picker Sheet preview
Rendered from the SwiftUI source on this page.

Picker Sheet

From syxUI — written for both platforms, not translated between them.

A wheel-picker sheet with Cancel / Done.

Cards · SwiftUI · iOS 17

  • cards
  • swiftui

The actual source

PickerSheet.swift
// Picker Sheet · syxUI · https://syxui.dev/components/sheet-picker
// Free in any project. Keep this line and credit syxUI where a person can read it.

import SwiftUI

let shBlue = Color(red: 0.0, green: 0.47, blue: 1.0)

func shCard<C: View>(_ w: CGFloat, radius: CGFloat = 18, @ViewBuilder _ c: () -> C) -> some View {
    c().frame(width: w).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: radius, style: .continuous)).overlay(RoundedRectangle(cornerRadius: radius, style: .continuous).stroke(Color.primary.opacity(0.07), lineWidth: 1)).shadow(color: .black.opacity(0.05), radius: 12, y: 5)
}

// Wheel picker sheet
struct PickerSheet: View {
    var body: some View {
        shCard(320, radius: 22) {
            VStack(spacing: 0) {
                HStack { Text("Cancel").font(.system(size: 16)).foregroundStyle(shBlue); Spacer(); Text("Select").font(.system(size: 16, weight: .semibold)); Spacer(); Text("Done").font(.system(size: 16, weight: .semibold)).foregroundStyle(shBlue) }.padding(16)
                Divider()
                VStack(spacing: 10) {
                    Text("Small").font(.system(size: 18)).foregroundStyle(.secondary.opacity(0.4))
                    Text("Medium").font(.system(size: 20, weight: .semibold))
                    Text("Large").font(.system(size: 18)).foregroundStyle(.secondary.opacity(0.4))
                }.padding(.vertical, 18).frame(maxWidth: .infinity).overlay { RoundedRectangle(cornerRadius: 8).fill(Color.primary.opacity(0.04)).frame(height: 34) }
            }
        }
    }
}
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17