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
720
Coding Swift with Visual Studio Code and Docker
usamik26
0
480
Swift Extension for Visual Studio Code
usamik26
2
970
Other Decks in Programming
See All in Programming
AWS Lambda functions with C# 用の Dev Container Template を作ってみた件
mappie_kochi
0
240
2024年のWebフロントエンドのふりかえりと2025年
sakito
1
240
AIの力でお手軽Chrome拡張機能作り
taiseiue
0
170
ISUCON14公式反省会LT: 社内ISUCONの話
astj
PRO
0
190
Rails アプリ地図考 Flush Cut
makicamel
1
110
なぜイベント駆動が必要なのか - CQRS/ESで解く複雑系システムの課題 -
j5ik2o
9
3.4k
Spring gRPC について / About Spring gRPC
mackey0225
0
220
SwiftUIで単方向アーキテクチャを導入して得られた成果
takuyaosawa
0
270
SwiftUI Viewの責務分離
elmetal
PRO
1
220
SpringBoot3.4の構造化ログ #kanjava
irof
2
980
最近のVS Codeで気になるニュース 2025/01
74th
1
260
Amazon ECS とマイクロサービスから考えるシステム構成
hiyanger
2
520
Featured
See All Featured
Facilitating Awesome Meetings
lara
51
6.2k
GraphQLの誤解/rethinking-graphql
sonatard
68
10k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
4
410
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
9
430
Scaling GitHub
holman
459
140k
We Have a Design System, Now What?
morganepeng
51
7.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
How GitHub (no longer) Works
holman
313
140k
Docker and Python
trallard
44
3.3k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Raft: Consensus for Rubyists
vanstee
137
6.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