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
830
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
580
Apple HIG 正式名称クイズ結果発表 / HIG Quiz Result
usamik26
0
150
ゆめみ大技林製作委員会の立ち上げの話 / daigirin project
usamik26
0
300
@ViewLoadingプロパティラッパの紹介と自前で実装する方法 / @ViewLoading property wrapper implementation
usamik26
0
450
これからUICollectionViewを実践活用する人のためのガイド / Guide to UICollectionView
usamik26
1
710
Xcodeとの最近の付き合い方のはなし / Approach To Xcode
usamik26
2
640
UICollectionView Compositional Layout
usamik26
0
730
Coding Swift with Visual Studio Code and Docker
usamik26
0
480
Swift Extension for Visual Studio Code
usamik26
2
980
Other Decks in Programming
See All in Programming
クリーンアーキテクチャから見る依存の向きの大切さ
shimabox
4
920
Djangoアプリケーション 運用のリアル 〜問題発生から可視化、最適化への道〜 #pyconshizu
kashewnuts
1
260
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1.1k
Honoをフロントエンドで使う 3つのやり方
yusukebe
7
3.5k
Amazon Q Developer Proで効率化するAPI開発入門
seike460
PRO
0
120
『品質』という言葉が嫌いな理由
korimu
0
180
楽しく向き合う例外対応
okutsu
0
570
新宿駅構内を三人称視点で探索してみる
satoshi7190
2
110
Better Code Design in PHP
afilina
0
160
データの整合性を保つ非同期処理アーキテクチャパターン / Async Architecture Patterns
mokuo
53
18k
Kotlinの開発でも AIをいい感じに使いたい / Making the Most of AI in Kotlin Development
kohii00
2
220
Rubyで始める関数型ドメインモデリング
shogo_tksk
0
130
Featured
See All Featured
Visualization
eitanlees
146
15k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
3.7k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.1k
BBQ
matthewcrist
87
9.5k
Making the Leap to Tech Lead
cromwellryan
133
9.1k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.2k
Side Projects
sachag
452
42k
GitHub's CSS Performance
jonrohan
1030
460k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
114
50k
Optimizing for Happiness
mojombo
376
70k
Code Reviewing Like a Champion
maltzj
521
39k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
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