Created
July 28, 2025 20:34
-
-
Save jacobsapps/88c40a4145fafe5e1dcc810d3dfb0e6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func scheduleCountdownAlarm() async throws { | |
let stopButton = AlarmButton( | |
text: "Mmm, Elvanse", | |
textColor: .white, | |
systemImageName: "checkmark.seal.fill" | |
) | |
let repeatButton = AlarmButton( | |
text: "I forgot", | |
textColor: .red, | |
systemImageName: "repeat.circle.fill" | |
) | |
let alertPresentation = AlarmPresentation.Alert( | |
title: "Take your meds!", | |
stopButton: stopButton, | |
secondaryButton: repeatButton, | |
secondaryButtonBehavior: .countdown | |
) | |
let attributes = AlarmAttributes( | |
presentation: AlarmPresentation(alert: alertPresentation), | |
metadata: ADHDMetadata(), | |
tintColor: Color.orange | |
) | |
let countdownConfiguration = AlarmManager.AlarmConfiguration<ADHDMetadata> | |
.init( | |
countdownDuration: Alarm.CountdownDuration(preAlert: 10, postAlert: 10), | |
attributes: attributes | |
) | |
_ = try await AlarmManager.shared.schedule(id: UUID(), configuration: countdownConfiguration) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment