Pattern · Sheets and Alerts
NewSchedule Sheet SwiftUI Block
Pick when something happens: quick picks with real times, a calendar and time picker, repeat rules and Schedule.
The sheet for send later, a reminder or a booking. Quick picks resolve to real times and hide once they pass, Pick date and time opens a graphical calendar and a time picker in place, and Repeat covers Never, Daily, Weekdays, Weekly and custom days. Schedule names the chosen moment, runs your closure with a Schedule value and shows working, Scheduled and failed.
- SwiftUI
- iOS 17.0+
- schedule-sheet
$199 once, every piece included. See how installing works · Sign in
01
What's included
SwiftUI source you own, built on Apple frameworks only.
- Later today, Tonight, Tomorrow morning and Next week with their times
- Picks that have passed are hidden, even while the sheet is open
- A graphical calendar and a time picker that open in place
- Repeat: Never, Daily, Weekdays, Weekly or custom days of the week
- Schedule returns a Schedule value and shows working, Scheduled and failed
02
Implementation notes
How it behaves, what it handles, and the decisions behind it.
Quick picks list the usual moments with the time each resolves to: Later today (three hours on, on the hour), Tonight (8 PM), Tomorrow morning (9 AM) and Next week (Monday 9 AM). A pick that has already passed is hidden, and the list keeps itself current while the sheet is open. Pick date and time opens a graphical calendar and a time picker in place, starting on tomorrow morning, and reads the chosen moment once it closes. Repeat offers Never, Daily, Weekdays, Weekly and Custom, where Custom shows the days of the week as toggles. A note names the time zone the times are in. Schedule waits in a quiet fill until a moment is picked, then carries it in its label ("Schedule for Sat 9:00 AM"), runs your closure with a Schedule value, shows progress, then "Scheduled", and closes the sheet; a thrown error shows its message under the button. A custom time that has passed says so and holds the button.
Notes
ScheduleSheet(actionTitle:initial:quickPicks:showsRepeat:onSchedule:onDone:)needs onlyonSchedule. It is the sheet's content: no scroll view, background or padding of its own, so present it in a.sheet(the large detent fits the open calendar) inside aScrollViewwith 20 point margins, or place it inline.actionTitleis the button's verb: "Schedule", "Send later", "Remind me".ScheduleSheet.Scheduleis thedateof the first occurrence, arepeatRuleand thetimeZoneit was picked in. Pass one asinitialto edit it; its date opens selected in the calendar.ScheduleSheet.Repeatis.never,.daily,.weekdays(Monday to Friday),.weekly(on the first date's weekday) or.custom(Set<Int>), weekdays numbered asCalendardoes (1 is Sunday). Custom starts on the chosen date's weekday and always keeps one day on.ScheduleSheet.QuickPickis.laterToday,.tonight,.tomorrowMorningor.nextWeek, each with atitle, asymbolanddate(after:calendar:), which returns nil once the moment has passed. Later today stops at 8 PM and Tonight an hour before. PassquickPicksto choose and order them.showsRepeat: falsehides Repeat for one-off moments.onSchedule(Schedule)isasync throws. ThrowCancellationError()to go back to rest quietly, or aLocalizedErrorto show itserrorDescription.onDoneruns a moment after "Scheduled"; without it the block dismisses the presenting sheet.- Dates follow the environment's
calendarandtimeZone, so the first weekday, the day names and the zone note match the person's settings. - Haptics: a selection tick on each pick, success when scheduled, an error when it fails.
- VoiceOver reads each quick pick with its full date ("Tomorrow morning, Saturday, October 24 at 9:00 AM") and its selected state, Repeat as a menu with its value, and announces "Scheduled for ...". At accessibility sizes the symbol column steps aside and times drop under their titles.
- Reduce Motion turns the calendar opening and state changes into short fades.
ScheduleSheetExampleat the end ofScheduleSheet.swiftis a message draft with the sheet open; Schedule waits a moment, then succeeds and shows the time under the draft. PasswrapsInNavigationStack: falseto push it in your own stack.
Theming
- Reads
SPThemefrom@Environment(\.spTheme)and requires thedesign-systemitem. - The When and Repeat cards are
color.surfaceatradius.lg, rows at least 52 points withseparatorhairlines inset to the text; groups sit 24 points apart (space.xl). - Rows use
type.bodyintextPrimarywithtextSecondarysymbols in a 24 point column; times aretype.subheadintextSecondarywith monospaced digits; the chevron istextTertiary. The selected pick's check istextPrimary. - The calendar and time picker are tinted
textPrimary. Custom days arefillcircles,textPrimarywithsurfaceletters when on. - The zone note is
type.footnoteintextSecondary. - Schedule is the only accent:
accentwithaccentOnintype.headlineatradius.mdonce a moment is picked,fillwithtextTertiarybefore. Errors aredanger. - The calendar opens with
motion.smooth; picks and states change withmotion.snappy.
03
Keep building
Pieces that work well next to this one.