
Year Picker
From syxUI — written for both platforms, not translated between them.
A year selection list.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
PickerYear.swift
// Year Picker · syxUI · https://syxui.dev/components/picker-year
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let pkBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
func menuLikeYear() -> some View { VStack(spacing: 0) { ForEach(Array([("2024", false), ("2025", false), ("2026", true), ("2027", false)].enumerated()), id: \.offset) { i, y in HStack { Text(y.0).font(.system(size: 16, weight: y.1 ? .semibold : .regular)).foregroundStyle(y.1 ? pkBlue : .primary); Spacer(); if y.1 { Image(systemName: "checkmark").font(.system(size: 13, weight: .semibold)).foregroundStyle(pkBlue) } }.padding(.horizontal, 16).padding(.vertical, 12); if i < 3 { Divider() } } }.frame(width: 240).background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 14, style: .continuous)).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.08))) }
struct PickerYear: View { var body: some View { menuLikeYear() } }
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


