AK
Size: a a a
AK
S
// The method will be called on the delegate only if the application is in the foreground. If the method is not implemented or the handler is not called in a timely manner then the notification will not be presented. The application can choose to have the notification presented as a sound, badge, alert and/or in the notification list. This decision should be based on whether the information in the notification is otherwise visible to the user.
@available(iOS 10.0, *)
optional func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)
В
В
В
В
В
open func configureDateFormatter(for date: Date) {
switch true {
case Calendar.current.isDateInToday(date) || Calendar.current.isDateInYesterday(date):
formatter.doesRelativeDateFormatting = true
formatter.dateStyle = .short
formatter.timeStyle = .short
case Calendar.current.isDate(date, equalTo: Date(), toGranularity: .weekOfYear):
formatter.dateFormat = "EEEE h:mm a"
case Calendar.current.isDate(date, equalTo: Date(), toGranularity: .year):
formatter.dateFormat = "E, d MMM, h:mm a"
default:
formatter.dateFormat = "MMM d, yyyy, h:mm a"
}
}
IG
В
IG
open func configureDateFormatter(for date: Date) {
switch true {
case Calendar.current.isDateInToday(date) || Calendar.current.isDateInYesterday(date):
formatter.doesRelativeDateFormatting = true
formatter.dateStyle = .short
formatter.timeStyle = .short
case Calendar.current.isDate(date, equalTo: Date(), toGranularity: .weekOfYear):
formatter.dateFormat = "EEEE h:mm a"
case Calendar.current.isDate(date, equalTo: Date(), toGranularity: .year):
formatter.dateFormat = "E, d MMM, h:mm a"
default:
formatter.dateFormat = "MMM d, yyyy, h:mm a"
}
}
В
В
В
MS
В
В
IG