Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Advanced Notification for iOS 10
Search
USAMI Kosuke
September 28, 2016
Programming
1
810
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
Onsager代数とその周辺 / Onsager algebra tsudoi
usamik26
0
470
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
80
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
260
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
400
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
650
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
560
UICollectionView Compositional Layout
usamik26
0
610
Coding Swift with Visual Studio Code and Docker
usamik26
0
400
Swift Extension for Visual Studio Code
usamik26
2
810
Other Decks in Programming
See All in Programming
最近追加した型の紹介とその振り返り
aki19035vc
0
180
Webエディタライブラリ 「CodeMirror」から学ぶ Webアプリ開発のテクニック
ryosukeigarashi
0
250
初心者がおさえておきたいAWS CDKのベストプラクティス 2024
konokenj
15
7.3k
CSC307 Lecture 12
javiergs
PRO
0
220
TiDB Serverless ~理想のServerless DBを考える~
soso_15315
1
160
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
Polarsの成長: v0.14からv1.0までの変遷と今後の展望
zerebom
1
350
Prompt FlowによるLLMアプリケーション開発
yuto2000
1
1k
AWS初心者ってどうやってAWSを学ぶ?〜アプリエンジニアがやってよかったアーキテクチャ学習方法〜
yamanashi_ren01
0
190
Terraformテスト入門
msato
0
540
Jetpack for KMP
fornewid
1
290
ドメイン駆動設計の実践
masuda220
PRO
19
5.2k
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
18
2.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
34
1.9k
The Cult of Friendly URLs
andyhume
75
5.9k
Fashionably flexible responsive web design (full day workshop)
malarkey
399
65k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
29
2.5k
Navigating Team Friction
lara
181
13k
The Mythical Team-Month
searls
217
43k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
36
9.1k
WebSockets: Embracing the real-time Web
robhawkes
59
7.2k
Building Effective Engineering Teams - LeadDev
addyosmani
47
2.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
149
45k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
26
1.8k
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