setting a local notification at specific time every day swift
let notificationContent = UNMutableNotificationContent()
notificationContent.title = "Title"
notificationContent.body = "This is a test"
notificationContent.badge = NSNumber(value: 1)
notificationContent.sound = .default
var datComp = DateComponents()
datComp.hour = 8
datComp.minute = 0
let trigger = UNCalendarNotificationTrigger(dateMatching: datComp, repeats: true)
let request = UNNotificationRequest(identifier: "ID", content: notificationContent, trigger: trigger)
UNCenter.add(request) { (error : Error?) in
if let theError = error {
print(theError as! String)
}
}
Also in Swift:
- how do i have countdown timer in swift stackoverflow
- swift change background color
- round up swift
- core data save
- add toggle without text swiftui
- swift uiview add tap gesture
- swift check if string contains string
- swift 5 progress bar height
- map swift
- swift
- swift navigation bar title color
- swift get slected row data in tableview cell
- Module compiled with Swift 5.3 cannot be imported by the Swift 5.3.1 compiler
- get keyboard height swift
- button sizetofit not working swift
- how to get appdelegate object in swift
- swift play video from url
- special symbol ios swift
- xcode execute function from a different file
- how to use alamofire pod in swift 5
- generate hmac swift
- how to find circle point in line chart swift 4 site:stackoverflow.com
- text field passing data
- how to add button to alert swiftui