Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Advanced Notification for iOS 10
USAMI Kosuke
September 28, 2016
Programming
1
760
Advanced Notification for iOS 10
http://kanmoba.connpass.com/event/39869/
USAMI Kosuke
September 28, 2016
Tweet
Share
More Decks by USAMI Kosuke
See All by USAMI Kosuke
Swift Regex
usamik26
0
160
Meet Swift Regex
usamik26
0
340
SwiftPM BuildTool Plugins
usamik26
1
690
try swift-docc-plugin
usamik26
2
320
AppDocumentation
usamik26
0
290
20220217-geekcamp-slides-usami
usamik26
0
110
Quaternion Rotation
usamik26
0
360
Swift-DocC
usamik26
0
330
Octonion
usamik26
0
110
Other Decks in Programming
See All in Programming
How we run a Realtime Puzzle Fighting Game on AWS Serverless
falken
0
250
模組化的Swift架構(二) DDD速成
haifengkao
0
380
The strategies behind ddd – AdeoDevSummit 2022
lilobase
PRO
4
250
[DevTrends - Jun/2022] Arquitetura baseada em eventos
camilacampos
0
150
無限スクロールビューライブラリ 二つの設計思想比較
harumak
0
180
はてなフォトライフをECSに移行した話 / Hatena Engineer Seminar #20
cohalz
1
830
Treasure.map(): Functional programming in JVM-based languages
paranoidmonoid
0
130
Web API連携でCSRF対策がどう実装されてるか調べた / how to implements csrf-detection on Web API
yasuakiomokawa
2
370
Overview of The Modern Data Stack / モダンデータスタック概論
satoshihirose
6
3.3k
パターンマッチングを学んで新しいJavaの世界へ!Java 18までの目玉機能をおさらいしよう / Java 18 pattern matching
ihcomega56
3
400
Managing Error Messages with your Oracle Database REST APIs
thatjeffsmith
0
120
Amazon Aurora の v1 が EOL になるので 10 クラスタアップグレードして出てきたノウハウ
dekokun
0
860
Featured
See All Featured
Teambox: Starting and Learning
jrom
123
7.7k
10 Git Anti Patterns You Should be Aware of
lemiorhan
638
52k
YesSQL, Process and Tooling at Scale
rocio
157
12k
What's in a price? How to price your products and services
michaelherold
229
9.4k
Reflections from 52 weeks, 52 projects
jeffersonlam
337
17k
It's Worth the Effort
3n
172
25k
The Brand Is Dead. Long Live the Brand.
mthomps
46
2.7k
Unsuck your backbone
ammeep
659
55k
4 Signs Your Business is Dying
shpigford
169
20k
A Tale of Four Properties
chriscoyier
149
21k
Building a Scalable Design System with Sketch
lauravandoore
448
30k
Rails Girls Zürich Keynote
gr2m
86
12k
Transcript
Advanced Notification for iOS 10 USAMI Kosuke Fenrir Inc.
iOS Notification API
Old API ☞ UIApplication ☞ Registering for Notifications ☞ UIApplicationDelegate
☞ Handling Notifications
New API (iOS 10) ☞ UserNotifications framework ☞ UserNotificationsUI framework
References ☞ WWDC 2016 ☞ Introduction to Notifications ☞ Advanced
Notifications ☞ Apple Developer Documentation ☞ UserNotifications ☞ UserNotificationsUI
UserNotifications framework
Notification Center ☞ UNUserNotificationCenter
Request User Authorization ☞ UNUserNotificationCenter ☞ func requestAuthorization(_:completionHandler:)
Push Notification ☞ UIApplication ☞ func registerForRemoteNotifications() ☞ (Existing API)
Local Notification ☞ UNUserNotificationCenter ☞ func add(_:withCompletionHandler:) ☞ UNNotificationRequest ☞
content ☞ trigger : TimeInterval / Calendar / Location
In-App Presentation (New!) // UNUserNotificationCenterDelegate func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent
notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void) { // Show notification in foreground completionHandler([.alert, .sound, .badge]) }
Others ☞ Custom Action ☞ Notification Management
Advanced Notifications
Advanced Notifications (iOS 10) ☞ Media Attachments ☞ Rich Notification
(Custom User Interface)
Media Attachments
None
For Local Notification ☞ UNNotificationAttachment ☞ url : URL of
attachment ☞ type : UTI type
For Push Notification
Notification Service Extension ☞ UserNotifications framework ☞ UNNotificationServiceExtension
Download Attachment ☞ UNNotificationServiceExtension ☞ func didReceive(_:withContentHandler:) ☞ Download in
Service extension ☞ Create UNNotificationAttachment
Limited Processing Time ☞ UNNotificationServiceExtension ☞ func serviceExtensionTimeWillExpire() ☞ Provide
some fallback content
Limited File Size ☞ Audio : 5MB ☞ Image :
10MB ☞ Movie : 50MB
Rich Notification
None
To Display Rich Notification ☞ 3D Touch on Notification ☞
Swipe Left in Notification List ☞ Swipe Down in Notification Banner
Custom User Interface ☞ Custom Views (No interaction) ☞ Media
Attachment ☞ Media Playback ☞ Notification Action ☞ Text Input Action
Notification Content Extension ☞ UserNotificationsUI framework ☞ UNNotificationContentExtension
Custom UI ☞ To change layout ... ☞ In Info.plist
☞ Specify custom views ratio ☞ Show/Hide default contents
Custom Views ☞ UNNotificationContentExtension ☞ func didReceive(_:) ☞ Get UNNotification
☞ Display contents to custom views
Minimal implementation class NotificationViewController: UIViewController, UNNotificationContentExtension { @IBOutlet weak var
label: UILabel! func didReceive(_ notification: UNNotification) { label.text = notification.request.content.body } }
Media Attachment class NotificationViewController: UIViewController, UNNotificationContentExtension { func didReceive(_ notification:
UNNotification) { let content = notification.request.content let attachment = content.attachments.first // attachment: UNNotificationAttachment // ... } }
Media Playback ☞ UNNotificationContentExtension ☞ mediaPlayPauseButtonType ☞ none / default
/ overlay ☞ mediaPlayPauseButtonFrame / TintColor ☞ func mediaPlay() / func mediaPause()
Notification Action
Notification Action ☞ UNUserNotificationCenter ☞ Set UNNotificationAction ☞ UNNotificationContentExtension ☞
func didReceive(_:completionHandler:) ☞ Get UNNotificationResponse
Text Input Action ☞ UNNotificationAction ☞ → UNTextInputNotificationAction ☞ UNNotificationResponse
☞ → UNTextInputNotificationResponse
Summary
Summary ☞ New API ☞ UserNotifications / UserNotificationsUI ☞ Notification
Service extension ☞ Media Attachments ☞ Notification Content extension ☞ Custom Views / Action