macOS, iOS
[iOS] push alert 보λ΄λ λ²: UserNotifications
SweetDev
2019. 5. 11. 00:47
import UserNotifications
func goPushAlarm(){
let content = UNMutableNotificationContent()
content.title = "πβ¨κ°μ λ
Ήμν μκ°μ΄μμπβ¨"
content.subtitle = "μ§κΈμ λ―Έμ λΆν μμ
μ λ
Ήμν μκ°μ
λλ€! μνκΈ°κ°μ μν΄μ 미리 λ
Ήμν΄μ£ΌμΈμπ"
content.body = "11:00 AM ~ 1:00 PM λ―Έμ λΆν"
var date = DateComponents()
date.hour = 00
date.minute = 40
let trigger = UNCalendarNotificationTrigger(dateMatching: date, repeats: true)
let request = UNNotificationRequest(identifier: "timerdone", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
}
μ΄λ°μμΌλ‘ μ§λ©΄ λλ€ :)