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

Repeat Picker

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

A recurrence-rule picker.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

PickerRepeat.swift
// Repeat Picker · syxUI · https://syxui.dev/components/picker-repeat
// 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)

extension View {
    func formaCard(_ pad: CGFloat = 18) -> some View {
        self.padding(pad)
            .background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
            .overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
            .shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
    }
}

struct PickerRepeat: View { var body: some View { VStack(spacing: 0) { ForEach(Array([("Never", false), ("Daily", false), ("Weekly", true), ("Monthly", false)].enumerated()), id: \.offset) { i, o in HStack { Text(o.0).font(.system(size: 15)); Spacer(); if o.1 { Image(systemName: "checkmark").font(.system(size: 13, weight: .semibold)).foregroundStyle(pkBlue) } }.padding(.horizontal, 14).padding(.vertical, 12); if i < 3 { Divider() } } }.formaCard(6).frame(width: 280) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17