228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch...
Transcript of 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch...
![Page 1: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/1.jpg)
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.
Enhancing your apps for the next dimension of touch
App Frameworks #WWDC16
Session 228
A Peek at 3D Touch
Tyler Fox UIKit Frameworks EngineerPeter Hajas UIKit Frameworks Engineer
![Page 2: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/2.jpg)
Agenda
![Page 3: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/3.jpg)
Agenda
Overview of 3D Touch
![Page 4: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/4.jpg)
Agenda
Overview of 3D TouchHome Screen Quick Actions
![Page 5: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/5.jpg)
Agenda
Overview of 3D TouchHome Screen Quick ActionsPeek and Pop
![Page 6: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/6.jpg)
Agenda
Overview of 3D TouchHome Screen Quick ActionsPeek and PopUIPreviewInteraction
NEW
![Page 7: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/7.jpg)
Tour across the systemOverview of 3D Touch
![Page 8: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/8.jpg)
![Page 9: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/9.jpg)
647 x 1150
![Page 10: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/10.jpg)
647 x 1150
![Page 11: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/11.jpg)
647 x 1150
![Page 12: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/12.jpg)
647 x 1150
![Page 13: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/13.jpg)
![Page 14: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/14.jpg)
![Page 15: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/15.jpg)
![Page 16: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/16.jpg)
![Page 17: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/17.jpg)
647 x 1150
![Page 18: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/18.jpg)
647 x 1150
![Page 19: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/19.jpg)
Supporting 3D Touch
![Page 20: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/20.jpg)
Supporting 3D Touch
Accelerate access to existing features in your app
![Page 21: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/21.jpg)
Supporting 3D Touch
Accelerate access to existing features in your appEnable new immersive interactions
![Page 22: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/22.jpg)
Supporting 3D Touch
Accelerate access to existing features in your appEnable new immersive interactionsProvide a consistent experience across iOS
![Page 23: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/23.jpg)
Leap straight into action from the home screenHome Screen Quick Actions
![Page 24: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/24.jpg)
647 x 1150
![Page 25: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/25.jpg)
647 x 1150
![Page 26: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/26.jpg)
647 x 1150
![Page 27: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/27.jpg)
647 x 1150
![Page 28: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/28.jpg)
647 x 1150
![Page 29: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/29.jpg)
647 x 1150
![Page 30: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/30.jpg)
Home Screen Quick Actions
StaticDynamic
Two types
![Page 31: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/31.jpg)
Home Screen Quick ActionsStatic
![Page 32: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/32.jpg)
Home Screen Quick Actions
Defined in your app’s Info.plist
Static
![Page 33: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/33.jpg)
Home Screen Quick Actions
Defined in your app’s Info.plistAvailable as soon as your app has been installed
Static
![Page 34: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/34.jpg)
Home Screen Quick Actions
Defined in your app’s Info.plistAvailable as soon as your app has been installed
Static
![Page 35: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/35.jpg)
DynamicHome Screen Quick Actions
![Page 36: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/36.jpg)
DynamicHome Screen Quick Actions
Created by your app at runtime
![Page 37: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/37.jpg)
DynamicHome Screen Quick Actions
Created by your app at runtimeAvailable after the first launch of your app
![Page 38: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/38.jpg)
DynamicHome Screen Quick Actions
Created by your app at runtimeAvailable after the first launch of your appShown after any static quick actions (space permitting)
![Page 39: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/39.jpg)
DynamicHome Screen Quick Actions
Created by your app at runtimeAvailable after the first launch of your appShown after any static quick actions (space permitting)Can include a system icon, custom icon, or Address Book contact
![Page 40: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/40.jpg)
Using a contact for the iconDynamic Quick Actions
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
![Page 41: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/41.jpg)
Using a contact for the iconDynamic Quick Actions
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
// Make sure to request access to the user's contacts first
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
}
![Page 42: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/42.jpg)
Using a contact for the iconDynamic Quick Actions
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
// Make sure to request access to the user's contacts first
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let predicate = CNContact.predicateForContacts(matchingName: contactName)
let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [])
}
![Page 43: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/43.jpg)
Using a contact for the iconDynamic Quick Actions
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
// Make sure to request access to the user's contacts first
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let predicate = CNContact.predicateForContacts(matchingName: contactName)
let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [])
if let contact = contacts?.first {
contactIcon = UIApplicationShortcutIcon(contact: contact)
}
}
![Page 44: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/44.jpg)
Using a contact for the iconDynamic Quick Actions
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
// Make sure to request access to the user's contacts first
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let predicate = CNContact.predicateForContacts(matchingName: contactName)
let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [])
if let contact = contacts?.first {
contactIcon = UIApplicationShortcutIcon(contact: contact)
}
}
let icon = contactIcon ?? UIApplicationShortcutIcon(type: .message)
let contactName = "Lexi Torres"
var contactIcon: UIApplicationShortcutIcon? = nil
// Make sure to request access to the user's contacts first
if CNContactStore.authorizationStatus(for: .contacts) == .authorized {
let predicate = CNContact.predicateForContacts(matchingName: contactName)
let contacts = try? CNContactStore().unifiedContacts(matching: predicate, keysToFetch: [])
if let contact = contacts?.first {
contactIcon = UIApplicationShortcutIcon(contact: contact)
}
}
let icon = contactIcon ?? UIApplicationShortcutIcon(type: .message)
![Page 45: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/45.jpg)
Creating and registeringDynamic Quick Actions
// Create a dynamic quick action using the icon
let type = "com.company.app.sendChatTo"
let subtitle = "Send a chat"
let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName,
localizedSubtitle: subtitle, icon: icon)
![Page 46: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/46.jpg)
Creating and registeringDynamic Quick Actions
// Create a dynamic quick action using the icon
let type = "com.company.app.sendChatTo"
let subtitle = "Send a chat"
let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName,
localizedSubtitle: subtitle, icon: icon)
// Repeat as needed for any additional dynamic quick actions...
![Page 47: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/47.jpg)
Creating and registeringDynamic Quick Actions
// Create a dynamic quick action using the icon
let type = "com.company.app.sendChatTo"
let subtitle = "Send a chat"
let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName,
localizedSubtitle: subtitle, icon: icon)
// Repeat as needed for any additional dynamic quick actions...
let shortcutItems = [shortcutItem1, shortcutItem2, shortcutItem3]
![Page 48: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/48.jpg)
Creating and registeringDynamic Quick Actions
// Create a dynamic quick action using the icon
let type = "com.company.app.sendChatTo"
let subtitle = "Send a chat"
let shortcutItem1 = UIApplicationShortcutItem(type: type, localizedTitle: contactName,
localizedSubtitle: subtitle, icon: icon)
// Repeat as needed for any additional dynamic quick actions...
let shortcutItems = [shortcutItem1, shortcutItem2, shortcutItem3]
// Register the dynamic quick actions to display on the home screen
application.shortcutItems = shortcutItems
![Page 49: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/49.jpg)
647 x 1150
![Page 50: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/50.jpg)
On app activationHandling Quick Actions
func application(application: UIApplication,
performActionForShortcutItem shortcutItem: UIApplicationShortcutItem,
completionHandler: Bool -> Void) {
}
![Page 51: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/51.jpg)
On app activationHandling Quick Actions
func application(application: UIApplication,
performActionForShortcutItem shortcutItem: UIApplicationShortcutItem,
completionHandler: Bool -> Void) {
let didHandle: Bool = /* handle the quick action using shortcutItem */
completionHandler(didHandle)
}
![Page 52: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/52.jpg)
On app activationHandling Quick Actions
func application(application: UIApplication,
performActionForShortcutItem shortcutItem: UIApplicationShortcutItem,
completionHandler: Bool -> Void) {
let didHandle: Bool = /* handle the quick action using shortcutItem */
completionHandler(didHandle)
}
![Page 53: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/53.jpg)
On app launchHandling Quick Actions
func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
}
![Page 54: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/54.jpg)
On app launchHandling Quick Actions
func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var performAdditionalHandling = true
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey]
as? UIApplicationShortcutItem {
/* handle the quick action using shortcutItem */
performAdditionalHandling = false
}
return performAdditionalHandling
}
![Page 55: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/55.jpg)
On app launchHandling Quick Actions
func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var performAdditionalHandling = true
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey]
as? UIApplicationShortcutItem {
/* handle the quick action using shortcutItem */
performAdditionalHandling = false
}
return performAdditionalHandling
}
![Page 56: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/56.jpg)
On app launchHandling Quick Actions
func application(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
var performAdditionalHandling = true
if let shortcutItem = launchOptions?[UIApplicationLaunchOptionsShortcutItemKey]
as? UIApplicationShortcutItem {
/* handle the quick action using shortcutItem */
performAdditionalHandling = false
}
return performAdditionalHandling
}
![Page 57: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/57.jpg)
Best practicesHome Screen Quick Actions
![Page 58: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/58.jpg)
Best practicesHome Screen Quick Actions
Every app should provide quick actions
![Page 59: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/59.jpg)
Best practicesHome Screen Quick Actions
Every app should provide quick actionsFocus on providing quick access to high-value tasks
![Page 60: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/60.jpg)
Best practicesHome Screen Quick Actions
Every app should provide quick actionsFocus on providing quick access to high-value tasksMake quick actions predictable
![Page 61: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/61.jpg)
Best practicesHome Screen Quick Actions
Every app should provide quick actionsFocus on providing quick access to high-value tasksMake quick actions predictableBe prepared to handle dynamic quick actions from a previous version of your app
![Page 62: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/62.jpg)
Best practicesHome Screen Quick Actions
Every app should provide quick actionsFocus on providing quick access to high-value tasksMake quick actions predictableBe prepared to handle dynamic quick actions from a previous version of your appDon’t add functionality that is only accessible using quick actions
![Page 63: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/63.jpg)
Peter Hajas UIKit Frameworks Engineer
Peek and PopSeamlessly preview and navigate to content
![Page 64: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/64.jpg)
![Page 65: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/65.jpg)
![Page 66: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/66.jpg)
![Page 67: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/67.jpg)
![Page 68: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/68.jpg)
![Page 69: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/69.jpg)
Preview
![Page 70: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/70.jpg)
![Page 71: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/71.jpg)
![Page 72: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/72.jpg)
Commit
![Page 73: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/73.jpg)
Adding Peek and Pop to Your AppComponents of the interaction
![Page 74: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/74.jpg)
Adding Peek and Pop to Your App
Registered View Controller
Components of the interaction
![Page 75: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/75.jpg)
Adding Peek and Pop to Your App
Registered View Controller
Source
Registered View Controller
Components of the interaction
![Page 76: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/76.jpg)
Adding Peek and Pop to Your App
Registered View Controller Previewed View Controller
Source
Registered View Controller
Source
Components of the interaction
![Page 77: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/77.jpg)
Adding Peek and Pop to Your App
Registered View Controller Previewed View Controller
Source
Components of the interaction
![Page 78: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/78.jpg)
Conforming to UIViewControllerPreviewingDelegateAdding Peek and Pop to Your App
class ChatTableViewController : UITableViewController,
UIViewControllerPreviewingDelegate
![Page 79: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/79.jpg)
Conforming to UIViewControllerPreviewingDelegateAdding Peek and Pop to Your App
class ChatTableViewController : UITableViewController,
UIViewControllerPreviewingDelegate
![Page 80: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/80.jpg)
Registering for previewingAdding Peek and Pop to Your App
override func viewDidLoad() {
super.viewDidLoad()
registerForPreviewing(with: self, sourceView: tableView)
}
![Page 81: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/81.jpg)
Registering for previewingAdding Peek and Pop to Your App
override func viewDidLoad() {
super.viewDidLoad()
registerForPreviewing(with: self, sourceView: tableView)
}
![Page 82: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/82.jpg)
Registering for previewingAdding Peek and Pop to Your App
override func viewDidLoad() {
super.viewDidLoad()
registerForPreviewing(with: self, sourceView: tableView)
}
![Page 83: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/83.jpg)
Providing a preview view controllerAdding Peek and Pop to Your App
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
}
![Page 84: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/84.jpg)
Providing a preview view controllerAdding Peek and Pop to Your App
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
}
![Page 85: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/85.jpg)
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else { return nil }
}
Providing a preview view controllerAdding Peek and Pop to Your App
![Page 86: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/86.jpg)
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else { return nil }
let chatDetailViewController = ...
chatDetailViewController.chatItem = chatItem(at: indexPath)
}
Providing a preview view controllerAdding Peek and Pop to Your App
![Page 87: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/87.jpg)
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else { return nil }
let chatDetailViewController = ...
chatDetailViewController.chatItem = chatItem(at: indexPath)
let cellRect = tableView.rectForRow(at: indexPath)
let sourceRect = previewingContext.sourceView.convert(cellRect, from: tableView)
previewingContext.sourceRect = sourceRect
}
Providing a preview view controllerAdding Peek and Pop to Your App
![Page 88: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/88.jpg)
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = tableView.indexPathForRow(at: location) else { return nil }
let chatDetailViewController = ...
chatDetailViewController.chatItem = chatItem(at: indexPath)
let cellRect = tableView.rectForRow(at: indexPath)
let sourceRect = previewingContext.sourceView.convert(cellRect, from: tableView)
previewingContext.sourceRect = sourceRect
return chatDetailViewController
}
Providing a preview view controllerAdding Peek and Pop to Your App
![Page 89: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/89.jpg)
![Page 90: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/90.jpg)
![Page 91: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/91.jpg)
Committing a preview view controllerAdding Peek and Pop to Your App
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
commit viewControllerToCommit: UIViewController) {
show(viewControllerToCommit, sender: self)
}
![Page 92: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/92.jpg)
Committing a preview view controllerAdding Peek and Pop to Your App
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
commit viewControllerToCommit: UIViewController) {
show(viewControllerToCommit, sender: self)
}
![Page 93: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/93.jpg)
Committing a preview view controllerAdding Peek and Pop to Your App
func previewingContext(_ previewingContext: UIViewControllerPreviewing,
commit viewControllerToCommit: UIViewController) {
show(viewControllerToCommit, sender: self)
}
![Page 94: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/94.jpg)
![Page 95: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/95.jpg)
![Page 96: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/96.jpg)
![Page 97: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/97.jpg)
![Page 98: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/98.jpg)
Preview quick actions
Registered View Controller Previewed View Controller
Source
Peek and Pop
![Page 99: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/99.jpg)
override func previewActionItems() -> [UIPreviewActionItem] {
let heart = UIPreviewAction(title: "❤", style: .default) { (action, viewController) in
// Send a heart
}
return [heart]
}
Preview quick actionsAdding Peek and Pop to Your App
![Page 100: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/100.jpg)
override func previewActionItems() -> [UIPreviewActionItem] {
let heart = UIPreviewAction(title: "❤", style: .default) { (action, viewController) in
// Send a heart
}
return [heart]
}
Preview quick actionsAdding Peek and Pop to Your App
![Page 101: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/101.jpg)
let replyActions = [UIPreviewAction(title: "❤", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😄", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "👍", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😯", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😢", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😈", style: .default, handler: replyActionHandler)]
let sendReply = UIPreviewActionGroup(title: "Send Reply…",
style: .default,
actions: replyActions)
Preview quick action groupsAdding Peek and Pop to Your App
![Page 102: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/102.jpg)
let replyActions = [UIPreviewAction(title: "❤", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😄", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "👍", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😯", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😢", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😈", style: .default, handler: replyActionHandler)]
let sendReply = UIPreviewActionGroup(title: "Send Reply…",
style: .default,
actions: replyActions)
Preview quick action groupsAdding Peek and Pop to Your App
![Page 103: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/103.jpg)
let replyActions = [UIPreviewAction(title: "❤", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😄", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "👍", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😯", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😢", style: .default, handler: replyActionHandler),
UIPreviewAction(title: "😈", style: .default, handler: replyActionHandler)]
let sendReply = UIPreviewActionGroup(title: "Send Reply…",
style: .default,
actions: replyActions)
Preview quick action groupsAdding Peek and Pop to Your App
![Page 104: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/104.jpg)
Other preview quick action stylesAdding Peek and Pop to Your App
let save = UIPreviewAction(title: "Chat Saved", style: .selected, handler: saveHandler)
let block = UIPreviewAction(title: "Block", style: .destructive, handler: blockHandler)
![Page 105: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/105.jpg)
Best practicesPeek and Pop
![Page 106: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/106.jpg)
Best practicesPeek and Pop
Content that can be tapped should support Peek and Pop
![Page 107: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/107.jpg)
Best practicesPeek and Pop
Content that can be tapped should support Peek and PopReturn a preview view controller consistently
![Page 108: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/108.jpg)
Best practicesPeek and Pop
Content that can be tapped should support Peek and PopReturn a preview view controller consistentlyDon’t take too long in the previewing delegate
![Page 109: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/109.jpg)
Best practicesPeek and Pop
Content that can be tapped should support Peek and PopReturn a preview view controller consistentlyDon’t take too long in the previewing delegateSet the previewing context sourceRect
![Page 110: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/110.jpg)
Peek and Pop feel with your user interfaceUIPreviewInteraction
NEW
![Page 111: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/111.jpg)
![Page 112: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/112.jpg)
![Page 113: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/113.jpg)
![Page 114: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/114.jpg)
![Page 115: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/115.jpg)
![Page 116: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/116.jpg)
![Page 117: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/117.jpg)
![Page 118: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/118.jpg)
![Page 119: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/119.jpg)
![Page 120: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/120.jpg)
![Page 121: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/121.jpg)
![Page 122: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/122.jpg)
![Page 123: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/123.jpg)
Same Peek and Pop Force Processing
Automatic Haptic Feedback Your User Interface
UIPreviewInteraction
+ +
![Page 124: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/124.jpg)
extension ChatDetailViewController : UIPreviewInteractionDelegate
UIPreviewInteractionDelegateUIPreviewInteraction
![Page 125: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/125.jpg)
override func viewDidLoad() {
super.viewDidLoad()
replyPreviewInteraction = UIPreviewInteraction(view: view)
replyPreviewInteraction.delegate = self
}
Creating the UIPreviewInteractionUIPreviewInteraction
![Page 126: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/126.jpg)
override func viewDidLoad() {
super.viewDidLoad()
replyPreviewInteraction = UIPreviewInteraction(view: view)
replyPreviewInteraction.delegate = self
}
Creating the UIPreviewInteractionUIPreviewInteraction
![Page 127: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/127.jpg)
Starting the interactionUIPreviewInteraction
previewInteractionShouldBegin()previewInteractionShouldBegin()
Preview
![Page 128: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/128.jpg)
State transitionsUIPreviewInteraction
Preview
![Page 129: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/129.jpg)
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
Preview
![Page 130: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/130.jpg)
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
0.200.400.60
0.80
Preview
![Page 131: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/131.jpg)
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
0.10
Preview
![Page 132: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/132.jpg)
0.20
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
0.40
0.600.80
1.00Preview
![Page 133: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/133.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdatePreviewTransition transitionProgress: CGFloat,
ended: Bool) {
updateForPreview(progress: transitionProgress)
if ended {
completePreview()
}
}
Preview transitionUIPreviewInteraction
![Page 134: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/134.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdatePreviewTransition transitionProgress: CGFloat,
ended: Bool) {
updateForPreview(progress: transitionProgress)
if ended {
completePreview()
}
}
Preview transitionUIPreviewInteraction
![Page 135: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/135.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdatePreviewTransition transitionProgress: CGFloat,
ended: Bool) {
updateForPreview(progress: transitionProgress)
if ended {
completePreview()
}
}
Preview transitionUIPreviewInteraction
![Page 136: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/136.jpg)
func previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction) {
UIView.animate(withDuration: 0.4) {
self.updateForPreview(progress: 0)
self.resetToInitialAppearance()
}
}
CancellationUIPreviewInteraction
![Page 137: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/137.jpg)
func previewInteractionDidCancel(_ previewInteraction: UIPreviewInteraction) {
UIView.animate(withDuration: 0.4) {
self.updateForPreview(progress: 0)
self.resetToInitialAppearance()
}
}
CancellationUIPreviewInteraction
![Page 138: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/138.jpg)
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
Preview
![Page 139: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/139.jpg)
State transitionsUIPreviewInteraction
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 140: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/140.jpg)
State transitionsUIPreviewInteraction
0.200.400.600.80
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 141: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/141.jpg)
State transitionsUIPreviewInteraction
0.10previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 142: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/142.jpg)
State transitionsUIPreviewInteraction
0.200.400.600.801.00
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 143: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/143.jpg)
State transitionsUIPreviewInteraction
0.200.400.600.801.00
0.200.400.600.80
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 144: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/144.jpg)
State transitionsUIPreviewInteraction
0.200.400.600.801.00
0.10
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 145: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/145.jpg)
State transitionsUIPreviewInteraction
0.200.400.600.801.00
0.200.400.600.801.00
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdatePreviewTransition:ended:)
previewInteraction(didUpdatePreviewTransition:ended:)previewInteraction(didUpdateCommitTransition:ended:)
Preview
Commit
![Page 146: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/146.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdateCommitTransition transitionProgress: CGFloat,
ended: Bool) {
updateForCommit(progress: transitionProgress)
if ended {
completeCommit()
}
}
Commit transitionUIPreviewInteraction
![Page 147: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/147.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdateCommitTransition transitionProgress: CGFloat,
ended: Bool) {
updateForCommit(progress: transitionProgress)
if ended {
completeCommit()
}
}
Commit transitionUIPreviewInteraction
![Page 148: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/148.jpg)
func previewInteraction(_ previewInteraction: UIPreviewInteraction,
didUpdateCommitTransition transitionProgress: CGFloat,
ended: Bool) {
updateForCommit(progress: transitionProgress)
if ended {
completeCommit()
}
}
Commit transitionUIPreviewInteraction
![Page 149: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/149.jpg)
Low-Level Force API
![Page 150: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/150.jpg)
Low-Level Force API
Normalized access to force data
![Page 151: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/151.jpg)
force maximumPossibleForce
Low-Level Force API
Normalized access to force dataProperties on UITouch: force and maximumPossibleForce
![Page 152: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/152.jpg)
force maximumPossibleForce
Low-Level Force API
Normalized access to force dataProperties on UITouch: force and maximumPossibleForceAvailable on devices that support 3D Touch or Apple Pencil
![Page 153: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/153.jpg)
force maximumPossibleForce
Low-Level Force API
Normalized access to force dataProperties on UITouch: force and maximumPossibleForceAvailable on devices that support 3D Touch or Apple Pencil
Leveraging Touch Input on iOS Pacific Heights Thursday 10:00AM
![Page 154: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/154.jpg)
Summary
![Page 155: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/155.jpg)
Summary
Home screen quick actions let you jump straight into action
![Page 156: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/156.jpg)
Summary
Home screen quick actions let you jump straight into actionPeek and Pop allow you to quickly preview and navigate to content
![Page 157: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/157.jpg)
Summary
Home screen quick actions let you jump straight into actionPeek and Pop allow you to quickly preview and navigate to contentUIPreviewInteraction opens up new possibilities to make your app more immersive
![Page 158: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/158.jpg)
Summary
Home screen quick actions let you jump straight into actionPeek and Pop allow you to quickly preview and navigate to contentUIPreviewInteraction opens up new possibilities to make your app more immersiveUsers expect your apps to support 3D Touch
![Page 159: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/159.jpg)
More Information
https://developer.apple.com/wwdc16/228
![Page 160: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/160.jpg)
Related Sessions
Advances in UIKit Animations and Transitions Pacific Heights Wednesday 5:00PM
Leveraging Touch Input on iOS Pacific Heights Thursday 10:00AM
![Page 161: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/161.jpg)
Labs
Cocoa Touch and 3D Touch Lab Frameworks Lab C Friday 10:30AM
![Page 162: 228 A Peek at 3D Touch 03 A FINAL › videos › wwdc › 2016 › 228a...Supporting 3D Touch Accelerate access to existing features in your app Enable new immersive interactions Provide](https://reader033.fdocuments.net/reader033/viewer/2022060505/5f1e8981bb06fe16303e05cd/html5/thumbnails/162.jpg)