SlideShare a Scribd company logo
1 of 41
Download to read offline
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

More Related Content

What's hot

Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScriptAndrew Dupont
 
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScripttaobao.com
 
iPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてKyosuke Takayama
 
Combatendo code smells em Java
Combatendo code smells em Java Combatendo code smells em Java
Combatendo code smells em Java Emmanuel Neri
 
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
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
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJsHenri Binsztok
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonfNataliya Patsovska
 
The next step, part 2
The next step, part 2The next step, part 2
The next step, part 2Pat Cavit
 
Injection de dépendances dans Symfony >= 3.3
Injection de dépendances dans Symfony >= 3.3Injection de dépendances dans Symfony >= 3.3
Injection de dépendances dans Symfony >= 3.3Vladyslav Riabchenko
 

What's hot (15)

Writing Maintainable JavaScript
Writing Maintainable JavaScriptWriting Maintainable JavaScript
Writing Maintainable JavaScript
 
運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript運用Closure Compiler 打造高品質的JavaScript
運用Closure Compiler 打造高品質的JavaScript
 
iPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについて
 
Combatendo code smells em Java
Combatendo code smells em Java Combatendo code smells em Java
Combatendo code smells em Java
 
Construindo APIs de forma produtiva com Spring Boot, Spring Data e Spring MVC
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
 
Opa presentation at GamesJs
Opa presentation at GamesJsOpa presentation at GamesJs
Opa presentation at GamesJs
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
 
JavaScript patterns
JavaScript patternsJavaScript patterns
JavaScript patterns
 
I os 11
I os 11I os 11
I os 11
 
Borrar
BorrarBorrar
Borrar
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Bienvenida
BienvenidaBienvenida
Bienvenida
 
The next step, part 2
The next step, part 2The next step, part 2
The next step, part 2
 
mobl
moblmobl
mobl
 
Injection de dépendances dans Symfony >= 3.3
Injection de dépendances dans Symfony >= 3.3Injection de dépendances dans Symfony >= 3.3
Injection de dépendances dans Symfony >= 3.3
 

Viewers also liked

Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}Idean France
 
CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}Idean France
 
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
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
 
Messages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas FontaineMessages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas FontaineIdean 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}
App groups, faire communiquer ses applications {Cocoaheads Montpellier}Idean France
 
Cocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboardingCocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboardingIdean France
 
Opérer un unbundling : 6 questions que les marques doivent se poser
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 poserIdean France
 
Sirikit par Julien Coudsi
Sirikit par Julien CoudsiSirikit par Julien Coudsi
Sirikit par Julien CoudsiIdean France
 
CocoaPods par David Yang
CocoaPods par David YangCocoaPods par David Yang
CocoaPods par David YangIdean 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 /...
Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /...Idean France
 
Un développeur sachant designer par Audrey Hacq
Un développeur sachant designer par Audrey HacqUn développeur sachant designer par Audrey Hacq
Un développeur sachant designer par Audrey HacqIdean France
 
Rendering unit tests par Nicolas Fontaine
Rendering unit tests par Nicolas FontaineRendering unit tests par Nicolas Fontaine
Rendering unit tests par Nicolas FontaineIdean 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...
Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat...Idean France
 
Les 10 Tendances du Design d'interface en 2016
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 2016Idean France
 
Les 5 Tendances de la Performance Digitale en 2016
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 2016Idean France
 
Les 9 Tendances Tech en 2016
Les 9 Tendances Tech en 2016Les 9 Tendances Tech en 2016
Les 9 Tendances Tech en 2016Idean France
 
Les 10 tendances de la User Experience en 2015
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 2015Idean France
 
Les bonnes pratiques du e-commerce
Les bonnes pratiques du e-commerceLes bonnes pratiques du e-commerce
Les bonnes pratiques du e-commerceUX REPUBLIC
 
Les 10 Tendances de l’Expérience Utilisateur en 2016
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 2016Idean France
 
Tendances du Design d'Interface 2017
Tendances du Design d'Interface 2017Tendances du Design d'Interface 2017
Tendances du Design d'Interface 2017Idean France
 

Viewers also liked (20)

Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}Programmation Orientée Protocole {Cocoaheads Montpellier}
Programmation Orientée Protocole {Cocoaheads Montpellier}
 
CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}CA Layer / Core Animation {Cocoaheads Montpellier}
CA Layer / Core Animation {Cocoaheads Montpellier}
 
Meetup CocoaHeads Montpellier : conférence sur l'Auto Layout
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
 
Messages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas FontaineMessages Extensions par Nicolas Fontaine
Messages Extensions par Nicolas Fontaine
 
App groups, faire communiquer ses applications {Cocoaheads Montpellier}
App groups, faire communiquer ses applications {Cocoaheads Montpellier}App groups, faire communiquer ses applications {Cocoaheads Montpellier}
App groups, faire communiquer ses applications {Cocoaheads Montpellier}
 
Cocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboardingCocoaheads Montpellier Meetup : Comment gérer son onboarding
Cocoaheads Montpellier Meetup : Comment gérer son onboarding
 
Opérer un unbundling : 6 questions que les marques doivent se poser
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
 
Sirikit par Julien Coudsi
Sirikit par Julien CoudsiSirikit par Julien Coudsi
Sirikit par Julien Coudsi
 
CocoaPods par David Yang
CocoaPods par David YangCocoaPods par David Yang
CocoaPods par David Yang
 
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 /...
Cocoaheads Montpellier Meetup : L'analyse de Code Statique avec Objective-C /...
 
Un développeur sachant designer par Audrey Hacq
Un développeur sachant designer par Audrey HacqUn développeur sachant designer par Audrey Hacq
Un développeur sachant designer par Audrey Hacq
 
Rendering unit tests par Nicolas Fontaine
Rendering unit tests par Nicolas FontaineRendering unit tests par Nicolas Fontaine
Rendering unit tests par Nicolas Fontaine
 
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...
Les Formulaires - Les bonnes pratiques pour une meilleure expérience utilisat...
 
Les 10 Tendances du Design d'interface en 2016
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
 
Les 5 Tendances de la Performance Digitale en 2016
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
 
Les 9 Tendances Tech en 2016
Les 9 Tendances Tech en 2016Les 9 Tendances Tech en 2016
Les 9 Tendances Tech en 2016
 
Les 10 tendances de la User Experience en 2015
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
 
Les bonnes pratiques du e-commerce
Les bonnes pratiques du e-commerceLes bonnes pratiques du e-commerce
Les bonnes pratiques du e-commerce
 
Les 10 Tendances de l’Expérience Utilisateur en 2016
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
 
Tendances du Design d'Interface 2017
Tendances du Design d'Interface 2017Tendances du Design d'Interface 2017
Tendances du Design d'Interface 2017
 

Similar to Cocoaheads Montpellier Meetup : 3D Touch for iOS

3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, MacoscopeMacoscope
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
 
iOS Automation Primitives
iOS Automation PrimitivesiOS Automation Primitives
iOS Automation PrimitivesSynack
 
UIAutomation + Mechanic.js
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.jsjaykz52
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Saulo Arruda
 
Iphone os dev sharing with new examples
Iphone os dev sharing with new examplesIphone os dev sharing with new examples
Iphone os dev sharing with new exampleskenshin03
 
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.
Taking Objective-C to the next level. UA Mobile 2016.UA Mobile
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS DevelopmentJussi Pohjolainen
 
Architecting Single Activity Applications (With or Without Fragments)
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 Varadi
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаГлеб Тарасов
 
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!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)Sarp Erdag
 
Mobile App Development: Primi passi con NativeScript e Angular 2
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 2Filippo Matteo Riggio
 
iOS Einführung am Beispiel von play NEXT TEE
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 TEEHendrik Ebel
 
Introduction to Handoff
Introduction to HandoffIntroduction to Handoff
Introduction to HandoffHarit Kothari
 
That’s My App - Running in Your Background - Draining Your Battery
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 BatteryMichael Galpin
 

Similar to Cocoaheads Montpellier Meetup : 3D Touch for iOS (20)

3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope3D Touch by Karol Kozub, Macoscope
3D Touch by Karol Kozub, Macoscope
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
iOS Automation Primitives
iOS Automation PrimitivesiOS Automation Primitives
iOS Automation Primitives
 
UIAutomation + Mechanic.js
UIAutomation + Mechanic.jsUIAutomation + Mechanic.js
UIAutomation + Mechanic.js
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4
 
Iphone os dev sharing with new examples
Iphone os dev sharing with new examplesIphone os dev sharing with new examples
Iphone os dev sharing with new examples
 
iOS
iOSiOS
iOS
 
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.
Taking Objective-C to the next level. UA Mobile 2016.
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS Development
 
iOS 7 SDK特訓班
iOS 7 SDK特訓班iOS 7 SDK特訓班
iOS 7 SDK特訓班
 
Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)Architecting Single Activity Applications (With or Without Fragments)
Architecting Single Activity Applications (With or Without Fragments)
 
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефонаКурсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
Курсы по мобильной разработке под iOS. 4 лекция. Возможности телефона
 
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!)
Hızlı Cocoa Geliştirme (Develop your next cocoa app faster!)
 
Mobile App Development: Primi passi con NativeScript e Angular 2
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
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
 
03 objective-c session 3
03  objective-c session 303  objective-c session 3
03 objective-c session 3
 
Android
AndroidAndroid
Android
 
Introduction to Handoff
Introduction to HandoffIntroduction to Handoff
Introduction to Handoff
 
That’s My App - Running in Your Background - Draining Your Battery
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
 

More from Idean France

Start with a Concept and Stop Designing like a Machine
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
 
Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !Idean France
 
Design systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outilsDesign systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outilsIdean France
 
La recette graphique
La recette graphiqueLa recette graphique
La recette graphiqueIdean France
 
Graph QL par Andy Gigon
Graph QL par Andy GigonGraph QL par Andy Gigon
Graph QL par Andy GigonIdean France
 
Cocoheads react native + redux par Nicolas Fontaine
Cocoheads   react native + redux par Nicolas FontaineCocoheads   react native + redux par Nicolas Fontaine
Cocoheads react native + redux par Nicolas FontaineIdean France
 
Meetup langages visuels - Backelite - novembre 2017
Meetup langages visuels - Backelite - novembre 2017Meetup langages visuels - Backelite - novembre 2017
Meetup langages visuels - Backelite - novembre 2017Idean 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 ?
Sketch pour les designers : pourquoi, quand et comment l'utiliser ?Idean France
 
From Business to Buttons by Pierre Harlé
From Business to Buttons by Pierre HarléFrom Business to Buttons by Pierre Harlé
From Business to Buttons by Pierre HarléIdean France
 
RX Swift avril 2017 - David Yang
RX Swift avril 2017 - David YangRX Swift avril 2017 - David Yang
RX Swift avril 2017 - David YangIdean France
 
UI Design Trends for 2017
UI Design Trends for 2017UI Design Trends for 2017
UI Design Trends for 2017Idean France
 
A developer who knows how to design by Audrey Hacq
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 HacqIdean 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...
FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr...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...
Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti...Idean France
 
How to design forms that deliver a great user experience
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 experienceIdean France
 
The top 9 Tech trends for 2016
The top 9 Tech trends for 2016The top 9 Tech trends for 2016
The top 9 Tech trends for 2016Idean France
 

More from Idean France (16)

Start with a Concept and Stop Designing like a Machine
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
 
Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !Design Systems : à votre marque, prêts, partez !
Design Systems : à votre marque, prêts, partez !
 
Design systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outilsDesign systems : Bench et reco sur les outils
Design systems : Bench et reco sur les outils
 
La recette graphique
La recette graphiqueLa recette graphique
La recette graphique
 
Graph QL par Andy Gigon
Graph QL par Andy GigonGraph QL par Andy Gigon
Graph QL par Andy Gigon
 
Cocoheads react native + redux par Nicolas Fontaine
Cocoheads   react native + redux par Nicolas FontaineCocoheads   react native + redux par Nicolas Fontaine
Cocoheads react native + redux par Nicolas Fontaine
 
Meetup langages visuels - Backelite - novembre 2017
Meetup langages visuels - Backelite - novembre 2017Meetup langages visuels - Backelite - novembre 2017
Meetup langages visuels - Backelite - novembre 2017
 
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 ?
Sketch pour les designers : pourquoi, quand et comment l'utiliser ?
 
From Business to Buttons by Pierre Harlé
From Business to Buttons by Pierre HarléFrom Business to Buttons by Pierre Harlé
From Business to Buttons by Pierre Harlé
 
RX Swift avril 2017 - David Yang
RX Swift avril 2017 - David YangRX Swift avril 2017 - David Yang
RX Swift avril 2017 - David Yang
 
UI Design Trends for 2017
UI Design Trends for 2017UI Design Trends for 2017
UI Design Trends for 2017
 
A developer who knows how to design by Audrey Hacq
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
 
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...
FLUPA - UX Days 2016 : "Quand les militaires se prennent au jeu du Design Spr...
 
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...
Cocoaheads Montpellier Meetup : La programmation réactive sur iOS avec Réacti...
 
How to design forms that deliver a great user experience
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
 
The top 9 Tech trends for 2016
The top 9 Tech trends for 2016The top 9 Tech trends for 2016
The top 9 Tech trends for 2016
 

Recently uploaded

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesChandrakantDivate1
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...nishasame66
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsChandrakantDivate1
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312wphillips114
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsChandrakantDivate1
 

Recently uploaded (6)

Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
Satara Call girl escort *74796//13122* Call me punam call girls 24*7hour avai...
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312Mobile App Penetration Testing Bsides312
Mobile App Penetration Testing Bsides312
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 

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