Skip to content
Weekday Select preview
Rendered from the SwiftUI source on this page.

Weekday Select

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

A repeat-on-weekdays selector.

Inputs · SwiftUI · iOS 17

  • inputs
  • swiftui

The actual source

PickerWeekday.swift
// Weekday Select · syxUI · https://syxui.dev/components/picker-weekday
// 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)

struct PickerWeekday: View { var body: some View { VStack(alignment: .leading, spacing: 12) { Text("Repeat on").font(.system(size: 15, weight: .semibold)); HStack(spacing: 0) { ForEach(Array(["M", "T", "W", "T", "F", "S", "S"].enumerated()), id: \.offset) { i, d in Text(d).font(.system(size: 14, weight: .semibold)).foregroundStyle([0, 2, 4].contains(i) ? .white : .secondary).frame(width: 36, height: 36).background { if [0, 2, 4].contains(i) { Circle().fill(pkBlue) } else { Circle().fill(Color.primary.opacity(0.05)) } }; if i < 6 { Spacer(minLength: 0) } } } }.frame(width: 320) } }
iOS 17 · No dependencies

Dependencies

SwiftUI
No external dependencies

Requires iOS 17