Cocoaheads Montpellier Meetup : 3D Touch for iOS

Idean France
Idean FranceIdean France
3DTOUCH
COCOAHEADS - MONTPELLIER - 14 AVRIL 2016
jerome.morissard@backelite.com	
  
https://github.com/leverdeterre
AU SOMMAIRE
QuickActions
Peek and Pop
Peek Quick Actions
2
COMMENT ? QUI ? QUAND ?
COMMENT, QUI, QUAND?
• Comment
Une couche supplémentaire…
iPhone 6S (7.1mm contre 6.9mm)
• Les appareils
iPhone 6S, 6S Plus
• Version d’OS
iOS9
4
QUICK ACTIONS
QUICK ACTIONS
Pression sur l’icône de l’application
4 items maximum
Ces items peuvent être statiques ou dynamiques
Le but : aller plus vite et recentrer l’utilisateur !
6
QUICK ACTIONS > STATIQUES
info.plist
7
UIApplicationShortcutItemType
la référence unique qu’aura l’action
(ex: com.jmo.add.to.favorite)
UIApplicationShortcutItemTitle le titre de l’action
UIApplicationShortcutItemSubtitle le sous titre de l’action
UIApplicationShortcutItemIconType une valeur de l’énumération UIApplicationShortcutIconType
UIApplicationShortcutItemIconFile
une image que l’on souhaite utiliser
(35x35, 1 couleur)
UIApplicationShortcutItemUserInfo un dictionnaire pour des informations complémentaires.
QUICK ACTIONS > STATIQUES
info.plist
8
UIApplicationShortcutItemType
la référence unique qu’aura l’action
(ex: com.jmo.add.to.favorite)
UIApplicationShortcutItemTitle le titre de l’action
UIApplicationShortcutItemSubtitle le sous titre de l’action
UIApplicationShortcutItemIconType une valeur de l’énumération UIApplicationShortcutIconType
UIApplicationShortcutItemIconFile
une image que l’on souhaite utiliser
(35x35, 1 couleur)
UIApplicationShortcutItemUserInfo un dictionnaire pour des informations complémentaires.
https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html
QUICK ACTIONS > STATIQUES > EXEMPLE DE PLIST
• info.plist
9
QUICK ACTIONS > DYNAMIQUES > UIAPPLICATION
10
@interface	
  UIApplication	
  (UIShortcutItems)	
  
//	
  Register	
  shortcuts	
  to	
  display	
  on	
  the	
  home	
  screen,	
  or	
  retrieve	
  currently	
  registered	
  shortcuts.	
  
@property	
  (nullable,	
  nonatomic,	
  copy)	
  NSArray<UIApplicationShortcutItem	
  *>	
  *shortcutItems	
  NS_AVAILABLE_IOS(9_0)	
  
__TVOS_PROHIBITED;	
  
@end	
  
[UIApplication	
  sharedApplication].shortcutItems	
  =	
  @[myAwesomeShortcutItem];
UIApplicationShortcutItem
QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS
11
@interface	
  UIApplicationShortcutItem	
  :	
  NSObject	
  <NSCopying,	
  NSMutableCopying>	
  
-­‐	
  (instancetype)init	
  NS_UNAVAILABLE;	
  
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedTitle:(NSString	
  *)localizedTitle	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedSubtitle:(nullable	
  NSString	
  *)localizedSubtitle	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  icon:(nullable	
  UIApplicationShortcutIcon	
  *)icon	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  userInfo:(nullable	
  NSDictionary	
  *)userInfo	
  NS_DESIGNATED_INITIALIZER;	
  
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  localizedTitle:(NSString	
  *)localizedTitle;	
  
@end	
  
QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS
12
@interface	
  UIApplicationShortcutItem	
  :	
  NSObject	
  <NSCopying,	
  NSMutableCopying>	
  
-­‐	
  (instancetype)init	
  NS_UNAVAILABLE;	
  
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedTitle:(NSString	
  *)localizedTitle	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedSubtitle:(nullable	
  NSString	
  *)localizedSubtitle	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  icon:(nullable	
  UIApplicationShortcutIcon	
  *)icon	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  userInfo:(nullable	
  NSDictionary	
  *)userInfo	
  NS_DESIGNATED_INITIALIZER;	
  
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  localizedTitle:(NSString	
  *)localizedTitle;	
  
@end	
  
QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS > INIT
13
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedTitle:(NSString	
  *)localizedTitle	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedSubtitle:(nullable	
  NSString	
  *)localizedSubtitle	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  icon:(nullable	
  UIApplicationShortcutIcon	
  *)icon	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  userInfo:(nullable	
  NSDictionary	
  *)userInfo	
  NS_DESIGNATED_INITIALIZER;	
  
QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS > INIT
14
-­‐	
  (instancetype)initWithType:(NSString	
  *)type	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedTitle:(NSString	
  *)localizedTitle	
  	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  localizedSubtitle:(nullable	
  NSString	
  *)localizedSubtitle	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  icon:(nullable	
  UIApplicationShortcutIcon	
  *)icon	
  	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  userInfo:(nullable	
  NSDictionary	
  *)userInfo	
  NS_DESIGNATED_INITIALIZER;	
  
QUICK ACTIONS > INTERCEPTION !
15
// Called when the user activates your application by selecting a shortcut on the home screen,
// except when -application:willFinishLaunchingWithOptions: or -
application:didFinishLaunchingWithOptions returns NO.
- (void)application:(UIApplication *)application
performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem
completionHandler:(void(^)(BOOL succeeded))completionHandler;
QUICK ACTIONS > INTERCEPTION !
16
// Called when the user activates your application by selecting a shortcut on the home screen,
// except when -application:willFinishLaunchingWithOptions: or -
application:didFinishLaunchingWithOptions returns NO.
- (void)application:(UIApplication *)application
performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem
completionHandler:(void(^)(BOOL succeeded))completionHandler;
- (BOOL)application:(UIApplication *)application
willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions;
UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsShortcutItemKey
QUICK ACTIONS > ASTUCES > 1
• Pas de simulateur, il faut un iPhone 6S ou 6S
• https://github.com/DeskConnect/SBShortcutMenuSimulator pour
permettre de simuler les QuickActions.
17
QUICK ACTIONS > ASTUCES > 2
• Internationalisation !
• En utilisant l’InfoPlist.strings, UIApplicationShortcutItemTitle
contiendra la clé de traduction.
18
QUICK ACTIONS > ASTUCES > 3
• Attention aux icônes systèmes, car Apple en rajoute !
19
typedef	
  NS_ENUM(NSInteger,	
  UIApplicationShortcutIconType)	
  {	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCompose,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypePlay,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypePause,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAdd,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeLocation,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeSearch,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeShare,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeProhibit	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeContact	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeHome	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMarkLocation	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeFavorite	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeLove	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCloud	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeInvitation	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeConfirmation	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMail	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMessage	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeDate	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTime	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCapturePhoto	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCaptureVideo	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTask	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTaskCompleted	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAlarm	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeBookmark	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeShuffle	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAudio	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeUpdate	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1)	
  
}	
  NS_ENUM_AVAILABLE_IOS(9_0);	
  
QUICK ACTIONS > ASTUCES > 3
• Attention aux icônes systèmes, car Apple en rajoute !
20
typedef	
  NS_ENUM(NSInteger,	
  UIApplicationShortcutIconType)	
  {	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCompose,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypePlay,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypePause,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAdd,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeLocation,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeSearch,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeShare,	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeProhibit	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeContact	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeHome	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMarkLocation	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeFavorite	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeLove	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCloud	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeInvitation	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeConfirmation	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMail	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeMessage	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeDate	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTime	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCapturePhoto	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeCaptureVideo	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTask	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeTaskCompleted	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAlarm	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeBookmark	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeShuffle	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeAudio	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1),	
  
	
  	
  	
  	
  UIApplicationShortcutIconTypeUpdate	
  	
  	
  	
  	
  	
  	
  	
  	
  NS_ENUM_AVAILABLE_IOS(9_1)	
  
}	
  NS_ENUM_AVAILABLE_IOS(9_0);	
  
-­‐	
  Xcode	
  7.1	
  pour	
  compiler	
  !	
  	
  
-­‐	
  iOS9.1	
  !
QUICK	
  ACTIONS	
  >	
  ASTUCES	
  >	
  4
• Les icônes 35x35, 1 couleur … sauf pour les contacts
21
@interface	
  UIApplicationShortcutIcon	
  (ContactsUI)	
  
+	
  (instancetype)iconWithContact:(CNContact	
  *)contact;	
  
@end	
  
PEEK AND POP
PEEK	
  AND	
  POP
• Dans l’application,
• Pression sur un « call to action » à l’écran,
• Prévisualisation,
• Affichage d’un écran final.
23
PEEK	
  AND	
  POP
Prévisualisation du détail
24
PEEK	
  AND	
  POP
Affichage du détail plein écran
25
PEEK	
  AND	
  POP	
  :	
  API
Une catégorie sur UIViewController
(UIViewControllerPreviewingRegistration)
Deux protocoles UIViewControllerPreviewingDelegate,
UIViewControllerPreviewing
26
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PREVIEWINGREGISTRATION
La catégorie sur UIViewController
(UIViewControllerPreviewingRegistration)
On enregistre/désabonne notre ViewController pour gérer la
prévisualisation.
27
@interface	
  UIViewController	
  (UIViewControllerPreviewingRegistration)	
  
//	
  Registers	
  a	
  view	
  controller	
  to	
  participate	
  with	
  3D	
  Touch	
  preview	
  (peek)	
  and	
  commit	
  (pop).	
  
-­‐	
  (id	
  <UIViewControllerPreviewing>)registerForPreviewingWithDelegate:
(id<UIViewControllerPreviewingDelegate>)delegate	
  sourceView:(UIView	
  *)sourceView	
  NS_AVAILABLE_IOS(9_0);	
  
-­‐	
  (void)unregisterForPreviewingWithContext:(id	
  <UIViewControllerPreviewing>)previewing	
  NS_AVAILABLE_IOS(9_0);	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PREVISUALISER
Le protocole UIViewControllerPreviewing est un protocole informatif,
28
@protocol	
  UIViewControllerPreviewing	
  <NSObject>	
  
//	
  This	
  gesture	
  can	
  be	
  used	
  to	
  cause	
  the	
  previewing	
  presentation	
  to	
  wait	
  until	
  one	
  of	
  your	
  gestures	
  fails	
  or	
  to	
  allow	
  
simultaneous	
  recognition	
  during	
  the	
  initial	
  phase	
  of	
  the	
  preview	
  presentation.	
  
@property	
  (nonatomic,	
  readonly)	
  UIGestureRecognizer	
  *previewingGestureRecognizerForFailureRelationship	
  
NS_AVAILABLE_IOS(9_0);	
  
@property	
  (nonatomic,	
  readonly)	
  id<UIViewControllerPreviewingDelegate>	
  delegate	
  NS_AVAILABLE_IOS(9_0);	
  
@property	
  (nonatomic,	
  readonly)	
  UIView	
  *sourceView	
  NS_AVAILABLE_IOS(9_0);	
  
//	
  This	
  rect	
  will	
  be	
  set	
  to	
  the	
  bounds	
  of	
  sourceView	
  before	
  each	
  call	
  to	
  
//	
  -­‐previewingContext:viewControllerForLocation:	
  
@property	
  (nonatomic)	
  CGRect	
  sourceRect	
  NS_AVAILABLE_IOS(9_0);	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PREVISUALISER
Le protocole UIViewControllerPreviewing est un protocole informatif,
29
@protocol	
  UIViewControllerPreviewing	
  <NSObject>	
  
//	
  This	
  gesture	
  can	
  be	
  used	
  to	
  cause	
  the	
  previewing	
  presentation	
  to	
  wait	
  until	
  one	
  of	
  your	
  gestures	
  fails	
  or	
  to	
  allow	
  
simultaneous	
  recognition	
  during	
  the	
  initial	
  phase	
  of	
  the	
  preview	
  presentation.	
  
@property	
  (nonatomic,	
  readonly)	
  UIGestureRecognizer	
  *previewingGestureRecognizerForFailureRelationship	
  
NS_AVAILABLE_IOS(9_0);	
  
@property	
  (nonatomic,	
  readonly)	
  id<UIViewControllerPreviewingDelegate>	
  delegate	
  NS_AVAILABLE_IOS(9_0);	
  
@property	
  (nonatomic,	
  readonly)	
  UIView	
  *sourceView	
  NS_AVAILABLE_IOS(9_0);	
  
//	
  This	
  rect	
  will	
  be	
  set	
  to	
  the	
  bounds	
  of	
  sourceView	
  before	
  each	
  call	
  to	
  
//	
  -­‐previewingContext:viewControllerForLocation:	
  
@property	
  (nonatomic)	
  CGRect	
  sourceRect	
  NS_AVAILABLE_IOS(9_0);	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PREVISUALISER
L’implémentation du protocole UIViewControllerPreviewingDelegate
Le système nous délègue :
La construction du contrôleur pour visualiser le détail (le retour du protocole),
Trouver la zone à mettre en avant (mise à jour du previewingContext.sourceRect)
30
NS_CLASS_AVAILABLE_IOS(9_0)	
  @protocol	
  UIViewControllerPreviewingDelegate	
  <NSObject>	
  
//	
  If	
  you	
  return	
  nil,	
  a	
  preview	
  presentation	
  will	
  not	
  be	
  performed	
  
-­‐	
  (nullable	
  UIViewController	
  *)previewingContext:(id	
  <UIViewControllerPreviewing>)previewingContext	
  
viewControllerForLocation:(CGPoint)location	
  NS_AVAILABLE_IOS(9_0);	
  
@end	
  
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  «	
  POPER	
  »
L’implémentation du protocole UIViewControllerPreviewingDelegate.
Le système nous délègue la finalisation la transaction.
On peut :
ne rien faire,
pousser le même contrôleur,
pousser un autre contrôleur,
faire une autre action.
31
NS_CLASS_AVAILABLE_IOS(9_0)	
  @protocol	
  UIViewControllerPreviewingDelegate	
  <NSObject>	
  
-­‐	
  (void)previewingContext:(id	
  <UIViewControllerPreviewing>)previewingContext	
  commitViewController:(UIViewController	
  
*)viewControllerToCommit	
  NS_AVAILABLE_IOS(9_0);	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  «	
  POPER	
  »
L’implémentation du protocole UIViewControllerPreviewingDelegate.
Le système nous délègue la finalisation la transaction.
On peut :
ne rien faire,
pousser le même contrôleur,
pousser un autre contrôleur,
faire une autre action.
32
NS_CLASS_AVAILABLE_IOS(9_0)	
  @protocol	
  UIViewControllerPreviewingDelegate	
  <NSObject>	
  
-­‐	
  (void)previewingContext:(id	
  <UIViewControllerPreviewing>)previewingContext	
  commitViewController:(UIViewController	
  
*)viewControllerToCommit	
  NS_AVAILABLE_IOS(9_0);	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  POUR	
  FAIRE	
  SIMPLE	
  !
33
NS_CLASS_AVAILABLE_IOS(9_0)	
  @protocol	
  UIViewControllerPreviewingDelegate	
  <NSObject>	
  
//	
  If	
  you	
  return	
  nil,	
  a	
  preview	
  presentation	
  will	
  not	
  be	
  performed	
  
-­‐	
  (nullable	
  UIViewController	
  *)previewingContext:(id	
  <UIViewControllerPreviewing>)previewingContext	
  
viewControllerForLocation:(CGPoint)location	
  NS_AVAILABLE_IOS(9_0);	
  
-­‐	
  (void)previewingContext:(id	
  <UIViewControllerPreviewing>)previewingContext	
  commitViewController:(UIViewController	
  
*)viewControllerToCommit	
  NS_AVAILABLE_IOS(9_0);	
  
@end	
  
Peek
Pop
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PEEK	
  QUICK	
  ACTIONS
Le contrôleur « peeké » peut exposer des actions en
faisant un geste vers le haut.
Les actions peuvent être regroupées sous forme de
blocs.
34
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  PEEK	
  QUICK	
  ACTIONS
35
Une catégorie « anonyme » sur UIViewController ()
@protocol	
  UIPreviewActionItem;	
  
@interface	
  UIViewController	
  ()	
  
-­‐	
  (NSArray	
  <id	
  <UIPreviewActionItem>>	
  *)previewActionItems	
  NS_AVAILABLE_IOS(9_0);	
  
@end	
  
NS_CLASS_AVAILABLE_IOS(9_0)	
  @protocol	
  UIPreviewActionItem	
  <NSObject>	
  
@property(nonatomic,	
  copy,	
  readonly)	
  NSString	
  *title;	
  
@end	
  
NS_CLASS_AVAILABLE_IOS(9_0)	
  @interface	
  UIPreviewAction	
  :	
  NSObject	
  <NSCopying,UIPreviewActionItem>	
  
@end	
  
NS_CLASS_AVAILABLE_IOS(9_0)	
  @interface	
  UIPreviewActionGroup	
  :	
  NSObject	
  <NSCopying,UIPreviewActionItem>	
  
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  DETECTION	
  DES	
  APPAREILS	
  ÉLIGIBLES
La propriété forceTouchCapability sur UITraitCollection
Attention aux appels d’API, forceTouchCapability (iOS9),
UITraitCollection (iOS8)
36
typedef NS_ENUM(NSInteger, UIForceTouchCapability) {
UIForceTouchCapabilityUnknown = 0,
UIForceTouchCapabilityUnavailable = 1,
UIForceTouchCapabilityAvailable = 2
};
NS_CLASS_AVAILABLE_IOS(8_0) @interface UITraitCollection : NSObject <NSCopying, NSSecureCoding>
…
@property (nonatomic, readonly) UIForceTouchCapability forceTouchCapability
NS_AVAILABLE_IOS(9_0); // unspecified: UIForceTouchCapabilityUnknown
…
@end
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  WEBVIEW
UIWebView et WKWebView
allowLinks = YES
37
PEEK	
  AND	
  POP	
  :	
  API	
  >	
  STORYBOARD	
  
Pas de code
Xcode 7.1
38
CONCLUSION
Mise en place peu coûteuse
Amélioration de l'interactivité des apps
Pas testable sur simulateur
iOS9 et iPhone 6S (Plus)
40
REFERENCES
Documentation	
  techniques	
  
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Adopting3DTouchOniPhone/index.html#//
apple_ref/doc/uid/TP40016543-­‐CH1-­‐SW1	
  
Guidelines	
  graphiques	
  
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/3DTouch.html#//apple_ref/doc/
uid/TP40006556-­‐CH71	
  
Tutoriels	
  
Quick	
  Actions	
  http://www.stringcode.co.uk/add-­‐ios-­‐9s-­‐quick-­‐actions-­‐shortcut-­‐support-­‐in-­‐15-­‐minutes-­‐right-­‐now/	
  
Peek	
  and	
  Pop	
  http://pinkstone.co.uk/how-­‐to-­‐use-­‐3d-­‐touch-­‐in-­‐ios-­‐9-­‐part-­‐1-­‐peek-­‐and-­‐pop/	
  
	
  	
  	
  	
  http://krakendev.io/peek-­‐pop/	
  
3D	
  Touch	
  http://engineering.instagram.com/posts/465414923641286/lessons-­‐learned-­‐with-­‐3D-­‐touch	
  
41
1 sur 41

Recommandé

Owasp orlando, april 13, 2016 par
Owasp orlando, april 13, 2016Owasp orlando, april 13, 2016
Owasp orlando, april 13, 2016Mikhail Sosonkin
198 vues38 diapositives
303 TANSTAAFL: Using Open Source iPhone UI Code par
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Codejonmarimba
942 vues41 diapositives
Understanding Functions and "this" in the World of ES2017+ par
Understanding Functions and "this" in the World of ES2017+Understanding Functions and "this" in the World of ES2017+
Understanding Functions and "this" in the World of ES2017+Bryan Hughes
125 vues31 diapositives
AngularJS: what is underneath the hood par
AngularJS: what is underneath the hood AngularJS: what is underneath the hood
AngularJS: what is underneath the hood DA-14
298 vues19 diapositives
droidQuery: The Android port of jQuery par
droidQuery: The Android port of jQuerydroidQuery: The Android port of jQuery
droidQuery: The Android port of jQueryPhDBrown
15.3K vues40 diapositives
안드로이드 세미나 2 par
안드로이드 세미나 2안드로이드 세미나 2
안드로이드 세미나 2ang0123dev
662 vues16 diapositives

Contenu connexe

Tendances

Writing Maintainable JavaScript par
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
3.1K vues74 diapositives
運用Closure Compiler 打造高品質的JavaScript par
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScripttaobao.com
383 vues48 diapositives
iPhoneOS3.1でのカメラAPIについて par
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてKyosuke Takayama
654 vues36 diapositives
Combatendo code smells em Java par
Combatendo code smells em Java Combatendo code smells em Java
Combatendo code smells em Java Emmanuel Neri
655 vues28 diapositives
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC par
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVCConstruindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVCEmmanuel Neri
1.7K vues29 diapositives
Opa presentation at GamesJs par
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJsHenri Binsztok
299 vues24 diapositives

Tendances(15)

Writing Maintainable JavaScript par Andrew Dupont
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
Andrew Dupont3.1K vues
運用Closure Compiler 打造高品質的JavaScript par taobao.com
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
taobao.com383 vues
iPhoneOS3.1でのカメラAPIについて par Kyosuke Takayama
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについて
Kyosuke Takayama654 vues
Combatendo code smells em Java par Emmanuel Neri
Combatendo code smells em Java Combatendo code smells em Java
Combatendo code smells em Java
Emmanuel Neri655 vues
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC par Emmanuel Neri
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVCConstruindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
Emmanuel Neri1.7K vues
The next step, part 2 par Pat Cavit
The next step, part 2The next step, part 2
The next step, part 2
Pat Cavit3.2K vues

En vedette

Programmation Orientée Protocole {Cocoaheads Montpellier} par
Programmation Orientée Protocole {Cocoaheads Montpellier}Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}Idean France
651 vues13 diapositives
CA Layer / Core Animation {Cocoaheads Montpellier} par
CA Layer / Core Animation {Cocoaheads Montpellier}CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}Idean France
676 vues20 diapositives
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout par
Meetup CocoaHeads Montpellier : conférence sur l'Auto LayoutMeetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Meetup CocoaHeads Montpellier : conférence sur l'Auto LayoutIdean France
2.8K vues129 diapositives
Messages Extensions par Nicolas Fontaine par
Messages Extensions par Nicolas FontaineMessages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas FontaineIdean France
622 vues24 diapositives
App groups, faire communiquer ses applications {Cocoaheads Montpellier} par
App groups, faire communiquer ses applications {Cocoaheads Montpellier}App groups, faire communiquer ses applications {Cocoaheads Montpellier}
App groups, faire communiquer ses applications {Cocoaheads Montpellier}Idean France
665 vues13 diapositives
Cocoaheads Montpellier Meetup : Comment gérer son onboarding par
Cocoaheads Montpellier Meetup : Comment gérer son onboardingCocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboardingIdean France
1K vues12 diapositives

En vedette(20)

Programmation Orientée Protocole {Cocoaheads Montpellier} par Idean France
Programmation Orientée Protocole {Cocoaheads Montpellier}Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}
Idean France651 vues
CA Layer / Core Animation {Cocoaheads Montpellier} par Idean France
CA Layer / Core Animation {Cocoaheads Montpellier}CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}
Idean France676 vues
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout par Idean France
Meetup CocoaHeads Montpellier : conférence sur l'Auto LayoutMeetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
Idean France2.8K vues
Messages Extensions par Nicolas Fontaine par Idean France
Messages Extensions par Nicolas FontaineMessages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas Fontaine
Idean France622 vues
App groups, faire communiquer ses applications {Cocoaheads Montpellier} par Idean France
App groups, faire communiquer ses applications {Cocoaheads Montpellier}App groups, faire communiquer ses applications {Cocoaheads Montpellier}
App groups, faire communiquer ses applications {Cocoaheads Montpellier}
Idean France665 vues
Cocoaheads Montpellier Meetup : Comment gérer son onboarding par Idean France
Cocoaheads Montpellier Meetup : Comment gérer son onboardingCocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboarding
Idean France1K vues
Opérer un unbundling : 6 questions que les marques doivent se poser par Idean France
Opérer un unbundling : 6 questions que les marques doivent se poserOpérer un unbundling : 6 questions que les marques doivent se poser
Opérer un unbundling : 6 questions que les marques doivent se poser
Idean France5.7K vues
Sirikit par Julien Coudsi par Idean France
Sirikit par Julien CoudsiSirikit par Julien Coudsi
Sirikit par Julien Coudsi
Idean France506 vues
Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /... par Idean France
Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /...Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /...
Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /...
Idean France942 vues
Un développeur sachant designer par Audrey Hacq par Idean France
Un développeur sachant designer par Audrey HacqUn développeur sachant designer par Audrey Hacq
Un développeur sachant designer par Audrey Hacq
Idean France1.2K vues
Rendering unit tests par Nicolas Fontaine par Idean France
Rendering unit tests par Nicolas FontaineRendering unit tests par Nicolas Fontaine
Rendering unit tests par Nicolas Fontaine
Idean France396 vues
Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat... par Idean France
Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat...Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat...
Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat...
Idean France8.4K vues
Les 10 Tendances du Design d'interface en 2016 par Idean France
Les 10 Tendances du Design d'interface en 2016Les 10 Tendances du Design d'interface en 2016
Les 10 Tendances du Design d'interface en 2016
Idean France5.7K vues
Les 5 Tendances de la Performance Digitale en 2016 par Idean France
Les 5 Tendances de la Performance Digitale en 2016Les 5 Tendances de la Performance Digitale en 2016
Les 5 Tendances de la Performance Digitale en 2016
Idean France1.6K vues
Les 9 Tendances Tech en 2016 par Idean France
Les 9 Tendances Tech en 2016Les 9 Tendances Tech en 2016
Les 9 Tendances Tech en 2016
Idean France6.7K vues
Les 10 tendances de la User Experience en 2015 par Idean France
Les 10 tendances de la User Experience en 2015Les 10 tendances de la User Experience en 2015
Les 10 tendances de la User Experience en 2015
Idean France19.6K vues
Les bonnes pratiques du e-commerce par UX REPUBLIC
Les bonnes pratiques du e-commerceLes bonnes pratiques du e-commerce
Les bonnes pratiques du e-commerce
UX REPUBLIC17.4K vues
Les 10 Tendances de l’Expérience Utilisateur en 2016 par Idean France
Les 10 Tendances de l’Expérience Utilisateur en 2016Les 10 Tendances de l’Expérience Utilisateur en 2016
Les 10 Tendances de l’Expérience Utilisateur en 2016
Idean France32K vues
Tendances du Design d'Interface 2017 par Idean France
Tendances du Design d'Interface 2017Tendances du Design d'Interface 2017
Tendances du Design d'Interface 2017
Idean France1.5K vues

Similaire à Cocoaheads Montpellier Meetup : 3D Touch for iOS

3D Touch by Karol Kozub, Macoscope par
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, MacoscopeMacoscope
543 vues53 diapositives
Adopting 3D Touch in your apps par
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
241 vues33 diapositives
iOS Automation Primitives par
iOS Automation PrimitivesiOS Automation Primitives
iOS Automation PrimitivesSynack
965 vues38 diapositives
UIAutomation + Mechanic.js par
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.jsjaykz52
3.4K vues27 diapositives
I phone勉強会 (2011.11.23) par
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
3.6K vues52 diapositives
Desenvolvimento iOS - Aula 4 par
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Saulo Arruda
885 vues17 diapositives

Similaire à Cocoaheads Montpellier Meetup : 3D Touch for iOS(20)

3D Touch by Karol Kozub, Macoscope par Macoscope
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope
Macoscope543 vues
iOS Automation Primitives par Synack
iOS Automation PrimitivesiOS Automation Primitives
iOS Automation Primitives
Synack965 vues
UIAutomation + Mechanic.js par jaykz52
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.js
jaykz523.4K vues
Desenvolvimento iOS - Aula 4 par Saulo Arruda
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4
Saulo Arruda885 vues
Iphone os dev sharing with new examples par kenshin03
Iphone os dev sharing with new examplesIphone os dev sharing with new examples
Iphone os dev sharing with new examples
kenshin03437 vues
Taking Objective-C to the next level. UA Mobile 2016. par UA Mobile
Taking Objective-C to the next level. UA Mobile 2016.Taking Objective-C to the next level. UA Mobile 2016.
Taking Objective-C to the next level. UA Mobile 2016.
UA Mobile296 vues
Architecting Single Activity Applications (With or Without Fragments) par Gabor Varadi
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
Gabor Varadi1.8K vues
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона par Глеб Тарасов
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!) par Sarp Erdag
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
Sarp Erdag1.1K vues
Mobile App Development: Primi passi con NativeScript e Angular 2 par Filippo Matteo Riggio
Mobile App Development: Primi passi con NativeScript e Angular 2Mobile App Development: Primi passi con NativeScript e Angular 2
Mobile App Development: Primi passi con NativeScript e Angular 2
iOS Einführung am Beispiel von play NEXT TEE par Hendrik Ebel
iOS Einführung am Beispiel von play NEXT TEEiOS Einführung am Beispiel von play NEXT TEE
iOS Einführung am Beispiel von play NEXT TEE
Hendrik Ebel1.6K vues
That’s My App - Running in Your Background - Draining Your Battery par Michael Galpin
That’s My App - Running in Your Background - Draining Your BatteryThat’s My App - Running in Your Background - Draining Your Battery
That’s My App - Running in Your Background - Draining Your Battery
Michael Galpin2.4K vues

Plus de Idean France

Start with a Concept and Stop Designing like a Machine par
Start with a Concept and Stop Designing like a MachineStart with a Concept and Stop Designing like a Machine
Start with a Concept and Stop Designing like a MachineIdean France
1.1K vues52 diapositives
Design Systems : à votre marque, prêts, partez ! par
Design Systems : à votre marque, prêts, partez !Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !Idean France
1.7K vues75 diapositives
Design systems : Bench et reco sur les outils par
Design systems : Bench et reco sur les outilsDesign systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outilsIdean France
2.8K vues49 diapositives
La recette graphique par
La recette graphiqueLa recette graphique
La recette graphiqueIdean France
1.7K vues28 diapositives
Graph QL par Andy Gigon par
Graph QL par Andy GigonGraph QL par Andy Gigon
Graph QL par Andy GigonIdean France
362 vues30 diapositives
Cocoheads react native + redux par Nicolas Fontaine par
Cocoheads   react native + redux par Nicolas FontaineCocoheads   react native + redux par Nicolas Fontaine
Cocoheads react native + redux par Nicolas FontaineIdean France
377 vues30 diapositives

Plus de Idean France(16)

Start with a Concept and Stop Designing like a Machine par Idean France
Start with a Concept and Stop Designing like a MachineStart with a Concept and Stop Designing like a Machine
Start with a Concept and Stop Designing like a Machine
Idean France1.1K vues
Design Systems : à votre marque, prêts, partez ! par Idean France
Design Systems : à votre marque, prêts, partez !Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !
Idean France1.7K vues
Design systems : Bench et reco sur les outils par Idean France
Design systems : Bench et reco sur les outilsDesign systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outils
Idean France2.8K vues
Cocoheads react native + redux par Nicolas Fontaine par Idean France
Cocoheads   react native + redux par Nicolas FontaineCocoheads   react native + redux par Nicolas Fontaine
Cocoheads react native + redux par Nicolas Fontaine
Idean France377 vues
Meetup langages visuels - Backelite - novembre 2017 par Idean France
Meetup langages visuels - Backelite - novembre 2017Meetup langages visuels - Backelite - novembre 2017
Meetup langages visuels - Backelite - novembre 2017
Idean France523 vues
Sketch pour les designers : pourquoi, quand et comment l'utiliser ? par Idean France
Sketch pour les designers : pourquoi, quand et comment l'utiliser ?Sketch pour les designers : pourquoi, quand et comment l'utiliser ?
Sketch pour les designers : pourquoi, quand et comment l'utiliser ?
Idean France2.2K vues
From Business to Buttons by Pierre Harlé par Idean France
From Business to Buttons by Pierre HarléFrom Business to Buttons by Pierre Harlé
From Business to Buttons by Pierre Harlé
Idean France224 vues
RX Swift avril 2017 - David Yang par Idean France
RX Swift avril 2017 - David YangRX Swift avril 2017 - David Yang
RX Swift avril 2017 - David Yang
Idean France340 vues
UI Design Trends for 2017 par Idean France
UI Design Trends for 2017UI Design Trends for 2017
UI Design Trends for 2017
Idean France2.8K vues
A developer who knows how to design by Audrey Hacq par Idean France
A developer who knows how to design by Audrey HacqA developer who knows how to design by Audrey Hacq
A developer who knows how to design by Audrey Hacq
Idean France1.7K vues
FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr... par Idean France
FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr...FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr...
FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr...
Idean France559 vues
Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti... par Idean France
Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti...Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti...
Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti...
Idean France570 vues
How to design forms that deliver a great user experience par Idean France
How to design forms that deliver a great user experienceHow to design forms that deliver a great user experience
How to design forms that deliver a great user experience
Idean France3K vues
The top 9 Tech trends for 2016 par Idean France
The top 9 Tech trends for 2016The top 9 Tech trends for 2016
The top 9 Tech trends for 2016
Idean France2K vues

Cocoaheads Montpellier Meetup : 3D Touch for iOS

  • 1. 3DTOUCH COCOAHEADS - MONTPELLIER - 14 AVRIL 2016 jerome.morissard@backelite.com   https://github.com/leverdeterre
  • 2. AU SOMMAIRE QuickActions Peek and Pop Peek Quick Actions 2
  • 3. COMMENT ? QUI ? QUAND ?
  • 4. COMMENT, QUI, QUAND? • Comment Une couche supplémentaire… iPhone 6S (7.1mm contre 6.9mm) • Les appareils iPhone 6S, 6S Plus • Version d’OS iOS9 4
  • 6. QUICK ACTIONS Pression sur l’icône de l’application 4 items maximum Ces items peuvent être statiques ou dynamiques Le but : aller plus vite et recentrer l’utilisateur ! 6
  • 7. QUICK ACTIONS > STATIQUES info.plist 7 UIApplicationShortcutItemType la référence unique qu’aura l’action (ex: com.jmo.add.to.favorite) UIApplicationShortcutItemTitle le titre de l’action UIApplicationShortcutItemSubtitle le sous titre de l’action UIApplicationShortcutItemIconType une valeur de l’énumération UIApplicationShortcutIconType UIApplicationShortcutItemIconFile une image que l’on souhaite utiliser (35x35, 1 couleur) UIApplicationShortcutItemUserInfo un dictionnaire pour des informations complémentaires.
  • 8. QUICK ACTIONS > STATIQUES info.plist 8 UIApplicationShortcutItemType la référence unique qu’aura l’action (ex: com.jmo.add.to.favorite) UIApplicationShortcutItemTitle le titre de l’action UIApplicationShortcutItemSubtitle le sous titre de l’action UIApplicationShortcutItemIconType une valeur de l’énumération UIApplicationShortcutIconType UIApplicationShortcutItemIconFile une image que l’on souhaite utiliser (35x35, 1 couleur) UIApplicationShortcutItemUserInfo un dictionnaire pour des informations complémentaires. https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html
  • 9. QUICK ACTIONS > STATIQUES > EXEMPLE DE PLIST • info.plist 9
  • 10. QUICK ACTIONS > DYNAMIQUES > UIAPPLICATION 10 @interface  UIApplication  (UIShortcutItems)   //  Register  shortcuts  to  display  on  the  home  screen,  or  retrieve  currently  registered  shortcuts.   @property  (nullable,  nonatomic,  copy)  NSArray<UIApplicationShortcutItem  *>  *shortcutItems  NS_AVAILABLE_IOS(9_0)   __TVOS_PROHIBITED;   @end   [UIApplication  sharedApplication].shortcutItems  =  @[myAwesomeShortcutItem]; UIApplicationShortcutItem
  • 11. QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS 11 @interface  UIApplicationShortcutItem  :  NSObject  <NSCopying,  NSMutableCopying>   -­‐  (instancetype)init  NS_UNAVAILABLE;   -­‐  (instancetype)initWithType:(NSString  *)type                                                            localizedTitle:(NSString  *)localizedTitle                                                  localizedSubtitle:(nullable  NSString  *)localizedSubtitle                                                                                            icon:(nullable  UIApplicationShortcutIcon  *)icon                                                                              userInfo:(nullable  NSDictionary  *)userInfo  NS_DESIGNATED_INITIALIZER;   -­‐  (instancetype)initWithType:(NSString  *)type  localizedTitle:(NSString  *)localizedTitle;   @end  
  • 12. QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS 12 @interface  UIApplicationShortcutItem  :  NSObject  <NSCopying,  NSMutableCopying>   -­‐  (instancetype)init  NS_UNAVAILABLE;   -­‐  (instancetype)initWithType:(NSString  *)type                                                            localizedTitle:(NSString  *)localizedTitle                                                  localizedSubtitle:(nullable  NSString  *)localizedSubtitle                                                                                            icon:(nullable  UIApplicationShortcutIcon  *)icon                                                                              userInfo:(nullable  NSDictionary  *)userInfo  NS_DESIGNATED_INITIALIZER;   -­‐  (instancetype)initWithType:(NSString  *)type  localizedTitle:(NSString  *)localizedTitle;   @end  
  • 13. QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS > INIT 13 -­‐  (instancetype)initWithType:(NSString  *)type                                                            localizedTitle:(NSString  *)localizedTitle                                                  localizedSubtitle:(nullable  NSString  *)localizedSubtitle                                                                                            icon:(nullable  UIApplicationShortcutIcon  *)icon                                                                              userInfo:(nullable  NSDictionary  *)userInfo  NS_DESIGNATED_INITIALIZER;  
  • 14. QUICK ACTIONS > DYNAMIQUES > SHORTCUTITEMS > INIT 14 -­‐  (instancetype)initWithType:(NSString  *)type                                                            localizedTitle:(NSString  *)localizedTitle                                                  localizedSubtitle:(nullable  NSString  *)localizedSubtitle                                                                                            icon:(nullable  UIApplicationShortcutIcon  *)icon                                                                              userInfo:(nullable  NSDictionary  *)userInfo  NS_DESIGNATED_INITIALIZER;  
  • 15. QUICK ACTIONS > INTERCEPTION ! 15 // Called when the user activates your application by selecting a shortcut on the home screen, // except when -application:willFinishLaunchingWithOptions: or - application:didFinishLaunchingWithOptions returns NO. - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler;
  • 16. QUICK ACTIONS > INTERCEPTION ! 16 // Called when the user activates your application by selecting a shortcut on the home screen, // except when -application:willFinishLaunchingWithOptions: or - application:didFinishLaunchingWithOptions returns NO. - (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void(^)(BOOL succeeded))completionHandler; - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(nullable NSDictionary *)launchOptions; UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsShortcutItemKey
  • 17. QUICK ACTIONS > ASTUCES > 1 • Pas de simulateur, il faut un iPhone 6S ou 6S • https://github.com/DeskConnect/SBShortcutMenuSimulator pour permettre de simuler les QuickActions. 17
  • 18. QUICK ACTIONS > ASTUCES > 2 • Internationalisation ! • En utilisant l’InfoPlist.strings, UIApplicationShortcutItemTitle contiendra la clé de traduction. 18
  • 19. QUICK ACTIONS > ASTUCES > 3 • Attention aux icônes systèmes, car Apple en rajoute ! 19 typedef  NS_ENUM(NSInteger,  UIApplicationShortcutIconType)  {          UIApplicationShortcutIconTypeCompose,          UIApplicationShortcutIconTypePlay,          UIApplicationShortcutIconTypePause,          UIApplicationShortcutIconTypeAdd,          UIApplicationShortcutIconTypeLocation,          UIApplicationShortcutIconTypeSearch,          UIApplicationShortcutIconTypeShare,          UIApplicationShortcutIconTypeProhibit              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeContact                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeHome                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMarkLocation      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeFavorite              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeLove                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCloud                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeInvitation          NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeConfirmation      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMail                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMessage                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeDate                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTime                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCapturePhoto      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCaptureVideo      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTask                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTaskCompleted    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeAlarm                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeBookmark              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeShuffle                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeAudio                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeUpdate                  NS_ENUM_AVAILABLE_IOS(9_1)   }  NS_ENUM_AVAILABLE_IOS(9_0);  
  • 20. QUICK ACTIONS > ASTUCES > 3 • Attention aux icônes systèmes, car Apple en rajoute ! 20 typedef  NS_ENUM(NSInteger,  UIApplicationShortcutIconType)  {          UIApplicationShortcutIconTypeCompose,          UIApplicationShortcutIconTypePlay,          UIApplicationShortcutIconTypePause,          UIApplicationShortcutIconTypeAdd,          UIApplicationShortcutIconTypeLocation,          UIApplicationShortcutIconTypeSearch,          UIApplicationShortcutIconTypeShare,          UIApplicationShortcutIconTypeProhibit              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeContact                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeHome                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMarkLocation      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeFavorite              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeLove                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCloud                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeInvitation          NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeConfirmation      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMail                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeMessage                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeDate                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTime                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCapturePhoto      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeCaptureVideo      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTask                      NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeTaskCompleted    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeAlarm                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeBookmark              NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeShuffle                NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeAudio                    NS_ENUM_AVAILABLE_IOS(9_1),          UIApplicationShortcutIconTypeUpdate                  NS_ENUM_AVAILABLE_IOS(9_1)   }  NS_ENUM_AVAILABLE_IOS(9_0);   -­‐  Xcode  7.1  pour  compiler  !     -­‐  iOS9.1  !
  • 21. QUICK  ACTIONS  >  ASTUCES  >  4 • Les icônes 35x35, 1 couleur … sauf pour les contacts 21 @interface  UIApplicationShortcutIcon  (ContactsUI)   +  (instancetype)iconWithContact:(CNContact  *)contact;   @end  
  • 23. PEEK  AND  POP • Dans l’application, • Pression sur un « call to action » à l’écran, • Prévisualisation, • Affichage d’un écran final. 23
  • 25. PEEK  AND  POP Affichage du détail plein écran 25
  • 26. PEEK  AND  POP  :  API Une catégorie sur UIViewController (UIViewControllerPreviewingRegistration) Deux protocoles UIViewControllerPreviewingDelegate, UIViewControllerPreviewing 26
  • 27. PEEK  AND  POP  :  API  >  PREVIEWINGREGISTRATION La catégorie sur UIViewController (UIViewControllerPreviewingRegistration) On enregistre/désabonne notre ViewController pour gérer la prévisualisation. 27 @interface  UIViewController  (UIViewControllerPreviewingRegistration)   //  Registers  a  view  controller  to  participate  with  3D  Touch  preview  (peek)  and  commit  (pop).   -­‐  (id  <UIViewControllerPreviewing>)registerForPreviewingWithDelegate: (id<UIViewControllerPreviewingDelegate>)delegate  sourceView:(UIView  *)sourceView  NS_AVAILABLE_IOS(9_0);   -­‐  (void)unregisterForPreviewingWithContext:(id  <UIViewControllerPreviewing>)previewing  NS_AVAILABLE_IOS(9_0);   @end
  • 28. PEEK  AND  POP  :  API  >  PREVISUALISER Le protocole UIViewControllerPreviewing est un protocole informatif, 28 @protocol  UIViewControllerPreviewing  <NSObject>   //  This  gesture  can  be  used  to  cause  the  previewing  presentation  to  wait  until  one  of  your  gestures  fails  or  to  allow   simultaneous  recognition  during  the  initial  phase  of  the  preview  presentation.   @property  (nonatomic,  readonly)  UIGestureRecognizer  *previewingGestureRecognizerForFailureRelationship   NS_AVAILABLE_IOS(9_0);   @property  (nonatomic,  readonly)  id<UIViewControllerPreviewingDelegate>  delegate  NS_AVAILABLE_IOS(9_0);   @property  (nonatomic,  readonly)  UIView  *sourceView  NS_AVAILABLE_IOS(9_0);   //  This  rect  will  be  set  to  the  bounds  of  sourceView  before  each  call  to   //  -­‐previewingContext:viewControllerForLocation:   @property  (nonatomic)  CGRect  sourceRect  NS_AVAILABLE_IOS(9_0);   @end
  • 29. PEEK  AND  POP  :  API  >  PREVISUALISER Le protocole UIViewControllerPreviewing est un protocole informatif, 29 @protocol  UIViewControllerPreviewing  <NSObject>   //  This  gesture  can  be  used  to  cause  the  previewing  presentation  to  wait  until  one  of  your  gestures  fails  or  to  allow   simultaneous  recognition  during  the  initial  phase  of  the  preview  presentation.   @property  (nonatomic,  readonly)  UIGestureRecognizer  *previewingGestureRecognizerForFailureRelationship   NS_AVAILABLE_IOS(9_0);   @property  (nonatomic,  readonly)  id<UIViewControllerPreviewingDelegate>  delegate  NS_AVAILABLE_IOS(9_0);   @property  (nonatomic,  readonly)  UIView  *sourceView  NS_AVAILABLE_IOS(9_0);   //  This  rect  will  be  set  to  the  bounds  of  sourceView  before  each  call  to   //  -­‐previewingContext:viewControllerForLocation:   @property  (nonatomic)  CGRect  sourceRect  NS_AVAILABLE_IOS(9_0);   @end
  • 30. PEEK  AND  POP  :  API  >  PREVISUALISER L’implémentation du protocole UIViewControllerPreviewingDelegate Le système nous délègue : La construction du contrôleur pour visualiser le détail (le retour du protocole), Trouver la zone à mettre en avant (mise à jour du previewingContext.sourceRect) 30 NS_CLASS_AVAILABLE_IOS(9_0)  @protocol  UIViewControllerPreviewingDelegate  <NSObject>   //  If  you  return  nil,  a  preview  presentation  will  not  be  performed   -­‐  (nullable  UIViewController  *)previewingContext:(id  <UIViewControllerPreviewing>)previewingContext   viewControllerForLocation:(CGPoint)location  NS_AVAILABLE_IOS(9_0);   @end  
  • 31. PEEK  AND  POP  :  API  >  «  POPER  » L’implémentation du protocole UIViewControllerPreviewingDelegate. Le système nous délègue la finalisation la transaction. On peut : ne rien faire, pousser le même contrôleur, pousser un autre contrôleur, faire une autre action. 31 NS_CLASS_AVAILABLE_IOS(9_0)  @protocol  UIViewControllerPreviewingDelegate  <NSObject>   -­‐  (void)previewingContext:(id  <UIViewControllerPreviewing>)previewingContext  commitViewController:(UIViewController   *)viewControllerToCommit  NS_AVAILABLE_IOS(9_0);   @end
  • 32. PEEK  AND  POP  :  API  >  «  POPER  » L’implémentation du protocole UIViewControllerPreviewingDelegate. Le système nous délègue la finalisation la transaction. On peut : ne rien faire, pousser le même contrôleur, pousser un autre contrôleur, faire une autre action. 32 NS_CLASS_AVAILABLE_IOS(9_0)  @protocol  UIViewControllerPreviewingDelegate  <NSObject>   -­‐  (void)previewingContext:(id  <UIViewControllerPreviewing>)previewingContext  commitViewController:(UIViewController   *)viewControllerToCommit  NS_AVAILABLE_IOS(9_0);   @end
  • 33. PEEK  AND  POP  :  API  >  POUR  FAIRE  SIMPLE  ! 33 NS_CLASS_AVAILABLE_IOS(9_0)  @protocol  UIViewControllerPreviewingDelegate  <NSObject>   //  If  you  return  nil,  a  preview  presentation  will  not  be  performed   -­‐  (nullable  UIViewController  *)previewingContext:(id  <UIViewControllerPreviewing>)previewingContext   viewControllerForLocation:(CGPoint)location  NS_AVAILABLE_IOS(9_0);   -­‐  (void)previewingContext:(id  <UIViewControllerPreviewing>)previewingContext  commitViewController:(UIViewController   *)viewControllerToCommit  NS_AVAILABLE_IOS(9_0);   @end   Peek Pop
  • 34. PEEK  AND  POP  :  API  >  PEEK  QUICK  ACTIONS Le contrôleur « peeké » peut exposer des actions en faisant un geste vers le haut. Les actions peuvent être regroupées sous forme de blocs. 34
  • 35. PEEK  AND  POP  :  API  >  PEEK  QUICK  ACTIONS 35 Une catégorie « anonyme » sur UIViewController () @protocol  UIPreviewActionItem;   @interface  UIViewController  ()   -­‐  (NSArray  <id  <UIPreviewActionItem>>  *)previewActionItems  NS_AVAILABLE_IOS(9_0);   @end   NS_CLASS_AVAILABLE_IOS(9_0)  @protocol  UIPreviewActionItem  <NSObject>   @property(nonatomic,  copy,  readonly)  NSString  *title;   @end   NS_CLASS_AVAILABLE_IOS(9_0)  @interface  UIPreviewAction  :  NSObject  <NSCopying,UIPreviewActionItem>   @end   NS_CLASS_AVAILABLE_IOS(9_0)  @interface  UIPreviewActionGroup  :  NSObject  <NSCopying,UIPreviewActionItem>   @end
  • 36. PEEK  AND  POP  :  API  >  DETECTION  DES  APPAREILS  ÉLIGIBLES La propriété forceTouchCapability sur UITraitCollection Attention aux appels d’API, forceTouchCapability (iOS9), UITraitCollection (iOS8) 36 typedef NS_ENUM(NSInteger, UIForceTouchCapability) { UIForceTouchCapabilityUnknown = 0, UIForceTouchCapabilityUnavailable = 1, UIForceTouchCapabilityAvailable = 2 }; NS_CLASS_AVAILABLE_IOS(8_0) @interface UITraitCollection : NSObject <NSCopying, NSSecureCoding> … @property (nonatomic, readonly) UIForceTouchCapability forceTouchCapability NS_AVAILABLE_IOS(9_0); // unspecified: UIForceTouchCapabilityUnknown … @end
  • 37. PEEK  AND  POP  :  API  >  WEBVIEW UIWebView et WKWebView allowLinks = YES 37
  • 38. PEEK  AND  POP  :  API  >  STORYBOARD   Pas de code Xcode 7.1 38
  • 40. Mise en place peu coûteuse Amélioration de l'interactivité des apps Pas testable sur simulateur iOS9 et iPhone 6S (Plus) 40
  • 41. REFERENCES Documentation  techniques   https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/Adopting3DTouchOniPhone/index.html#// apple_ref/doc/uid/TP40016543-­‐CH1-­‐SW1   Guidelines  graphiques   https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/3DTouch.html#//apple_ref/doc/ uid/TP40006556-­‐CH71   Tutoriels   Quick  Actions  http://www.stringcode.co.uk/add-­‐ios-­‐9s-­‐quick-­‐actions-­‐shortcut-­‐support-­‐in-­‐15-­‐minutes-­‐right-­‐now/   Peek  and  Pop  http://pinkstone.co.uk/how-­‐to-­‐use-­‐3d-­‐touch-­‐in-­‐ios-­‐9-­‐part-­‐1-­‐peek-­‐and-­‐pop/          http://krakendev.io/peek-­‐pop/   3D  Touch  http://engineering.instagram.com/posts/465414923641286/lessons-­‐learned-­‐with-­‐3D-­‐touch   41