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
840
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
630
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
180
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
330
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
480
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
740
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
670
UICollectionView Compositional Layout
usamik26
0
780
Coding Swift with Visual Studio Code and Docker
usamik26
0
510
Swift Extension for Visual Studio Code
usamik26
2
1k
Other Decks in Programming
See All in Programming
セキュリティマネジャー廃止とクラウドネイティブ型サンドボックス活用
kazumura
1
190
無関心の谷
kanayannet
0
180
TypeScript LSP の今までとこれから
quramy
1
510
XSLTで作るBrainfuck処理系
makki_d
0
210
SODA - FACT BOOK
sodainc
1
1.1k
Go Modules: From Basics to Beyond / Go Modulesの基本とその先へ
kuro_kurorrr
0
120
社内での開発コミュニティ活動とモジュラーモノリス標準化事例のご紹介/xPalette and Introduction of Modular monolith standardization
m4maruyama
1
130
Julia という言語について (FP in Julia « SIDE: F ») for 関数型まつり2025
antimon2
3
970
Haskell でアルゴリズムを抽象化する / 関数型言語で競技プログラミング
naoya
17
4.8k
業務自動化をJavaとSeleniumとAWS Lambdaで実現した方法
greenflagproject
1
120
Cline指示通りに動かない? AI小説エージェントで学ぶ指示書の書き方と自動アップデートの仕組み
kamomeashizawa
1
550
A2A プロトコルを試してみる
azukiazusa1
2
770
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
184
22k
Building Applications with DynamoDB
mza
95
6.5k
Product Roadmaps are Hard
iamctodd
PRO
53
11k
Embracing the Ebb and Flow
colly
86
4.7k
Designing Experiences People Love
moore
142
24k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
GitHub's CSS Performance
jonrohan
1031
460k
Speed Design
sergeychernyshev
31
1k
Gamification - CAS2011
davidbonilla
81
5.3k
Bash Introduction
62gerente
614
210k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3.3k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
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