using grouped notifications€¦ · michele campeotto, ios user notifications • using grouped...

98
#WWDC18 © 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Michele Campeotto, iOS User Notifications Using Grouped Notifications Session 711

Upload: others

Post on 22-Jul-2020

30 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

#WWDC18

© 2018 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Michele Campeotto, iOS User Notifications

•Using Grouped NotificationsSession 711

Page 2: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Notification groups •App grouping •Custom grouping •Group summaries

Page 3: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Notification Groups

Page 4: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 5: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 6: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 7: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 8: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 9: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 10: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 11: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•App Grouping

Page 12: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 13: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 14: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Custom Grouping

Page 15: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Creating Groups with Thread Identifiers

let content = UNMutableNotificationContent() content.title = "Notifications Team" content.body = "WWDC session after party" content.threadIdentifier = "notifications-team-chat"

Page 16: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Creating Groups with Thread Identifiers

let content = UNMutableNotificationContent() content.title = "Notifications Team" content.body = "WWDC session after party" content.threadIdentifier = "notifications-team-chat"

Page 17: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Creating Groups with Thread Identifiers

{ "aps" : { "alert" : { "title" : "Notifications Team", "body" : "WWDC session after party" } "thread-id" : "notifications-team-chat" } }

Page 18: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Creating Groups with Thread Identifiers

{ "aps" : { "alert" : { "title" : "Notifications Team", "body" : "WWDC session after party" } "thread-id" : "notifications-team-chat" } }

Page 19: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Custom Grouping Examples

Calendar

Messages

Mail

Page 20: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 21: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = nil

Page 22: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = nil

threadIdentifier = "alerts"

Page 23: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = nil

threadIdentifier = "alerts"

Page 24: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 25: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Separate important, actionable notifications from informative updates.

Page 26: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 27: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "gr-michele"

Page 28: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "gr-51413"

threadIdentifier = "gr-michele"

Page 29: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 30: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Create groups for meaningful, personal communications.

Page 31: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 32: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "acct-icloud"

Page 33: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "acct-icloud"

threadIdentifier = "vip-michele"

Page 34: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "acct-icloud"

threadIdentifier = "vip-michele"

threadIdentifier = "th-51413"

Page 35: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

threadIdentifier = "acct-icloud"

threadIdentifier = "vip-michele"

threadIdentifier = "th-51413"

Page 36: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Respect the user’s priorities and organization.

Page 37: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Notification Groups Summaries

Page 38: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 39: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 40: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 41: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 42: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Simple Notification Group Summary

let summaryFormat = "%u more messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 43: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Simple Notification Group Summary

let summaryFormat = "%u more messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 44: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Simple Notification Group Summary

let summaryFormat = "%u more messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 45: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Hidden Previews Summary Customization

let summaryFormat = "%u more messages" let hiddenPreviewsPlaceholder = "%u messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenPreviewsPlaceholder, categorySummaryFormat: summaryFormat, options: [])

Page 46: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Hidden Previews Summary Customization

let summaryFormat = "%u more messages" let hiddenPreviewsPlaceholder = "%u messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: hiddenPreviewsPlaceholder, categorySummaryFormat: summaryFormat, options: [])

Page 47: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 48: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary with Arguments

let summaryFormat = "%u more messages from %@"

return UNNotificationCategory(identifier: "group-messages", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 49: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary with Arguments

let summaryFormat = "%u more messages from %@"

return UNNotificationCategory(identifier: "group-messages", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 50: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary with Arguments

let summaryFormat = "%u more messages from %@"

return UNNotificationCategory(identifier: "group-messages", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 51: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary Argument

let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "notifications-team" content.summaryArgument = "Kritarth"

Page 52: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary Argument

let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "notifications-team" content.summaryArgument = "Kritarth"

Page 53: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary Argument

{ "aps" : { "alert" : { "body" : "…", "summary-arg" : "Kritarth" }, "thread-id" : "notifications-team" } }

Page 54: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Group Summary Argument

{ "aps" : { "alert" : { "body" : "…", "summary-arg" : "Kritarth" }, "thread-id" : "notifications-team" } }

Page 55: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 56: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 57: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 58: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 59: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 60: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Summary with Argument Count

let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "…" content.summaryArgument = "Song by Song" content.summaryArgumentCount = 3

Page 61: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Notification Summary with Argument Count

let content = UNMutableNotificationContent() content.body = "…" content.threadIdentifier = "…" content.summaryArgument = "Song by Song" content.summaryArgumentCount = 3

Page 62: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 63: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 64: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Argument Count

{ "aps" : { "alert" : { "body" : "…", "summary-arg" : "Song by Song", "summary-arg-count" : 3 }, "thread-id" : "notifications-team" } }

Page 65: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Argument Count

{ "aps" : { "alert" : { "body" : "…", "summary-arg" : "Song by Song", "summary-arg-count" : 3 }, "thread-id" : "notifications-team" } }

Page 66: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Summary Plurals and Localization

Page 67: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 68: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 69: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711
Page 70: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Localization

let summaryFormat = "%u more messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 71: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Localization

let summaryFormat = "%u more messages"

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 72: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Localization

let summaryFormat = NSString.localizedUserNotificationString(forKey: "NOTIFICATION_SUMMARY", arguments: nil)

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 73: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

// Summary Localization

let summaryFormat = NSString.localizedUserNotificationString(forKey: "NOTIFICATION_SUMMARY", arguments: nil)

return UNNotificationCategory(identifier: "category-identifier", actions: [], intentIdentifiers: [], hiddenPreviewsBodyPlaceholder: nil, categorySummaryFormat: summaryFormat, options: [])

Page 74: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification</string> <key>other</key> <string>%u more notifications</string> </dict> </dict> </dict> </plist>

Page 75: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification</string> <key>other</key> <string>%u more notifications</string> </dict> </dict> </dict> </plist>

Page 76: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>עוד עדכון אחד</string> <key>two</key> <string>עוד שני עדכונים</string> <key>many</key> <string>עוד %u עדכונים</string> </dict> </dict> </dict> </plist>

Page 77: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>עוד עדכון אחד</string> <key>two</key> <string>עוד שני עדכונים</string> <key>many</key> <string>עוד %u עדכונים</string> </dict> </dict> </dict> </plist>

Page 78: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>Еще %u уведомление</string> <key>few</key> <string>Еще %u уведомления</string> <key>many</key> <string>Еще %u уведомлений</string> </dict> </dict> </dict> </plist>

Page 79: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>Еще %u уведомление</string> <key>few</key> <string>Еще %u уведомления</string> <key>many</key> <string>Еще %u уведомлений</string> </dict> </dict> </dict> </plist>

Page 80: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization with Arguments --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification from %@</string> <key>other</key> <string>%u more notifications from %@</string> </dict> </dict> </dict> </plist>

Page 81: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization with Arguments --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification from %@</string> <key>other</key> <string>%u more notifications from %@</string> </dict> </dict> </dict> </plist>

Page 82: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization with Arguments --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification from %@</string> <key>other</key> <string>%u more notifications from %@</string> </dict> </dict> </dict> </plist>

Page 83: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization with Arguments --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification from %@</string> <key>other</key> <string>%u more notifications from %@</string> </dict> </dict> </dict> </plist>

Page 84: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

<!-- Summary Localization with Arguments --> <plist version="1.0"> <dict> <key>NOTIFICATION_SUMMARY</key> <dict> <key>NSStringLocalizedFormatKey</key> <string>%#@notifications@</string> <key>notifications</key> <dict> <key>NSStringFormatSpecTypeKey</key> <string>NSStringPluralRuleType</string> <key>NSStringFormatValueTypeKey</key> <string>u</string> <key>one</key> <string>%u more notification from %@</string> <key>other</key> <string>%u more notifications from %@</string> </dict> </dict> </dict> </plist>

Page 85: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Allowed Notification Summary Formats

Page 86: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Allowed Notification Summary Formats

Notifications count • %u more messages

Page 87: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Allowed Notification Summary Formats

Notifications count • %u more messages

Notifications count and arguments • %u more messages from %@

Page 88: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

•Quick Tips

Page 89: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Grouping Different Summaries

Page 90: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Grouping Different Summaries

Simple summaries are joined • 5 more messages and 3 more photos

Page 91: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Grouping Different Summaries

Simple summaries are joined • 5 more messages and 3 more photos

Summaries with arguments fall back to default • 8 more notifications

Page 92: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Rich Grouped Notifications

Extension receives the leading notification

public protocol UNNotificationContentExtension : NSObjectProtocol {

public func didReceive(_ notification: UNNotification)

}

Page 93: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Rich Grouped Notifications

Extension receives the leading notification

Extension can load other notifications

class UNUserNotificationCenter : NSObject {

func getDeliveredNotifications(completionHandler:([UNNotification]) -> Swift.Void)

}

Page 94: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

public protocol UNNotificationContentExtension : NSObjectProtocol {

public func didReceive(_ notification: UNNotification)

}

Rich Grouped Notifications

Extension receives the leading notification

Extension can load other notifications

Threading of additional notifications

Page 95: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Rich Grouped Notifications

Extension receives the leading notification

Extension can load other notifications

Threading of additional notifications

Remove notifications when read

class UNUserNotificationCenter : NSObject {

func removeDeliveredNotifications(withIdentifiers identifiers: [String])

}

Page 96: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

Summary

Grouped notifications to help organization

Custom summaries to improve clarity

Page 97: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711

More Informationhttps://developer.apple.com/wwdc2018/711

Notifications Lab Technology Lab 1 Wednesday 4:00PM

Notifications Lab Technology Lab 1 Thursday 9:00AM

Designing Notifications Hall 2 Friday 10:00AM

Page 98: Using Grouped Notifications€¦ · Michele Campeotto, iOS User Notifications • Using Grouped Notifications Session 711