Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Multitasking
The Hard Way
@micheletitolo

Lead Software Engineer, Capital One
What We’ll Cover
What are Multitasking and Adaptivity?

Creating Adaptivity

Tips, Tricks, and Gotchas
What Is Multitasking?
Adaptivity
Compact
Compact
Regular
Regular
✔
✔✔
x
Creating Adaptivity
• Launch.storyboard

• Full iPad rotation

• UITraitCollection
Mechanics
Apps Must Use A
Launch.Storyboard
Apps Must Allow
Full Rotation
Setting in Info.plist
UITraitCollection
horizontalSizeClass

verticalSizeClass
UITraitEnvironment

UIContentContainer
UITraitEnvironment
traitCollection
traitCollectionDidChange
UIView
UIViewController
UIPresentationController
UIContentContainer
viewWillTransitionToSize
willTransitionToTraitCollection
UIViewController
UIPresentationController
Different Use Cases
Responding To Changes
Multitasking Order
•applicationWillResignActive
•willTransitionToTraitCollection
•viewWillTransitionToSize
•traitCollectionDidChange
•applica...
•applicationWillResignActive
•willTransitionToTraitCollection
•viewWillTransitionToSize
•traitCollectionDidChange
•applica...
•applicationWillResignActive
•willTransitionToTraitCollection
•viewWillTransitionToSize
•traitCollectionDidChange
•applica...
Slideovers Are Still Inactive
Becoming Adaptive
Tools
Installed Views

Installed Constraints

Conditional Constraint Constants
Demo
Only Constraint Constants
Can Change
Tips, Tricks,
Gotchas
Autolayout
Rotation APIs
UISplitViewController
Compact == Modal
Still Can’t Be Pushed
Can Be Embedded
UIPopoverPresentationController
Also Fullscreen In Compact
UIPresentationController
Set modalPresentationStyle
To .Custom
adaptivePresentationStyleFor

TraitCollection:
UICollectionView
Don’t rely on
shouldInvalidateLayoutForBoundsChange
prepareLayout()
may have incorrect traits
use both
willTransitionToTraitCollection,
viewWillTransitionToSize
Bugs!
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
iPad iPhone 6/6+ iPad Pro
iOS 5 iOS 7
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
iPad iPhone 6/6+ iPad Pro
UIViewController
iOS 5 iOS 7
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
iPad iPhone 6/6+ iPad Pro
UIViewController
UIPopove...
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
iPad iPhone 6/6+ iPad Pro
UIViewController
UIPopove...
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
Autolayout
iPad iPhone 6/6+ iPad Pro
UICollectionVi...
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
Autolayout
iPad iPhone 6/6+ iPad Pro
UICollectionVi...
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
Autolayout
iPad iPhone 6/6+ iPad Pro
UICollectionVi...
iPhone 2 NowiPhone 3.2 iOS 6
iPhone 5
iOS 9iOS 8
UISplitViewController
Autolayout
iPad iPhone 6/6+ iPad Pro
Multitasking
U...
UITraitCollection Support
Has Been Added To
Older Components
Storyboards and Xibs
Frames Change When
Size Class Changes
First Time In A New Size Class
Adds Info To File
Misplaced Views In
Different Size Classes
Installed Views And Constraints Only
Work From Storyboards And Xibs
Conditional Constraint Constants Only
Work From Storyboards And Xibs
Any x Any
Constraints Must Be Set
For Any x Any
Even though no devices have that 

size class configuration
Pick A Size Class To Use
For Any x Any
Interface Builder Warnings
UI Will Look Weird
Use Constraint Priorities
Questions?
https://github.com/mtitolo/space

https://github.com/mtitolo/primaries
Photo Credits
• https://unsplash.com/photos/iiaXf9xmgbM

• https://unsplash.com/photos/85hdWh8KtR4

• https://unsplash.com...
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
Multitasking
You’ve finished this document.
Download and read it offline.
Upcoming SlideShare
Multitasking - The Good The Bad and The Ugly
Next
Upcoming SlideShare
Multitasking - The Good The Bad and The Ugly
Next
Download to read offline and view in fullscreen.

Share

Multitasking

Download to read offline

iOS 9 introduced multitasking, which allows apps to be used side by side on certain devices. Along with this came a number of new APIs for handling transitions between different screen configurations. However, integrating these new APIs in an exiting codebase can be trick, and often requires rethinking the way a component is structured. This talk will introduce multitasking, cover the new APIs available to handle different scenarios, and walk through some gotchas when adding support for multitasking into existing applications.

Related Books

Free with a 30 day trial from Scribd

See all

Multitasking

  1. 1. Multitasking The Hard Way @micheletitolo Lead Software Engineer, Capital One
  2. 2. What We’ll Cover What are Multitasking and Adaptivity? Creating Adaptivity Tips, Tricks, and Gotchas
  3. 3. What Is Multitasking?
  4. 4. Adaptivity
  5. 5. Compact Compact Regular Regular ✔ ✔✔ x
  6. 6. Creating Adaptivity
  7. 7. • Launch.storyboard • Full iPad rotation • UITraitCollection Mechanics
  8. 8. Apps Must Use A Launch.Storyboard
  9. 9. Apps Must Allow Full Rotation Setting in Info.plist
  10. 10. UITraitCollection horizontalSizeClass verticalSizeClass
  11. 11. UITraitEnvironment
 UIContentContainer
  12. 12. UITraitEnvironment traitCollection traitCollectionDidChange
  13. 13. UIView UIViewController UIPresentationController
  14. 14. UIContentContainer viewWillTransitionToSize willTransitionToTraitCollection
  15. 15. UIViewController UIPresentationController
  16. 16. Different Use Cases
  17. 17. Responding To Changes
  18. 18. Multitasking Order
  19. 19. •applicationWillResignActive •willTransitionToTraitCollection •viewWillTransitionToSize •traitCollectionDidChange •applicationDidBecomeActive Multitasking Order
  20. 20. •applicationWillResignActive •willTransitionToTraitCollection •viewWillTransitionToSize •traitCollectionDidChange •applicationDidBecomeActive Multitasking Order
  21. 21. •applicationWillResignActive •willTransitionToTraitCollection •viewWillTransitionToSize •traitCollectionDidChange •applicationDidBecomeActive Multitasking Order
  22. 22. Slideovers Are Still Inactive
  23. 23. Becoming Adaptive
  24. 24. Tools Installed Views Installed Constraints Conditional Constraint Constants
  25. 25. Demo
  26. 26. Only Constraint Constants Can Change
  27. 27. Tips, Tricks, Gotchas
  28. 28. Autolayout
  29. 29. Rotation APIs
  30. 30. UISplitViewController
  31. 31. Compact == Modal
  32. 32. Still Can’t Be Pushed
  33. 33. Can Be Embedded
  34. 34. UIPopoverPresentationController
  35. 35. Also Fullscreen In Compact
  36. 36. UIPresentationController
  37. 37. Set modalPresentationStyle To .Custom
  38. 38. adaptivePresentationStyleFor
 TraitCollection:
  39. 39. UICollectionView
  40. 40. Don’t rely on shouldInvalidateLayoutForBoundsChange
  41. 41. prepareLayout() may have incorrect traits
  42. 42. use both willTransitionToTraitCollection, viewWillTransitionToSize
  43. 43. Bugs!
  44. 44. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 iPad iPhone 6/6+ iPad Pro iOS 5 iOS 7
  45. 45. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 iPad iPhone 6/6+ iPad Pro UIViewController iOS 5 iOS 7
  46. 46. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController iPad iPhone 6/6+ iPad Pro UIViewController UIPopoverController iOS 5 iOS 7
  47. 47. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController iPad iPhone 6/6+ iPad Pro UIViewController UIPopoverController UIViewController Containment iOS 5 iOS 7
  48. 48. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController Autolayout iPad iPhone 6/6+ iPad Pro UICollectionView UIViewController UIPopoverController UIViewController Containment iOS 5 iOS 7
  49. 49. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController Autolayout iPad iPhone 6/6+ iPad Pro UICollectionView UIViewController UIPopoverController UITraitCollection UITraitEnvironment UIViewController Containment iOS 5 iOS 7
  50. 50. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController Autolayout iPad iPhone 6/6+ iPad Pro UICollectionView UIViewController UIPopoverController UIContentContainer UITraitCollection UITraitEnvironment UIViewController Containment iOS 5 iOS 7
  51. 51. iPhone 2 NowiPhone 3.2 iOS 6 iPhone 5 iOS 9iOS 8 UISplitViewController Autolayout iPad iPhone 6/6+ iPad Pro Multitasking UICollectionView UIViewController UIPopoverController UIStackView UIContentContainer UITraitCollection UITraitEnvironment UIViewController Containment iOS 5 iOS 7
  52. 52. UITraitCollection Support Has Been Added To Older Components
  53. 53. Storyboards and Xibs
  54. 54. Frames Change When Size Class Changes
  55. 55. First Time In A New Size Class Adds Info To File
  56. 56. Misplaced Views In Different Size Classes
  57. 57. Installed Views And Constraints Only Work From Storyboards And Xibs
  58. 58. Conditional Constraint Constants Only Work From Storyboards And Xibs
  59. 59. Any x Any
  60. 60. Constraints Must Be Set For Any x Any Even though no devices have that size class configuration
  61. 61. Pick A Size Class To Use For Any x Any
  62. 62. Interface Builder Warnings
  63. 63. UI Will Look Weird
  64. 64. Use Constraint Priorities
  65. 65. Questions? https://github.com/mtitolo/space https://github.com/mtitolo/primaries
  66. 66. Photo Credits • https://unsplash.com/photos/iiaXf9xmgbM • https://unsplash.com/photos/85hdWh8KtR4 • https://unsplash.com/photos/l5Tzv1alcps
  • JohnBocook

    Apr. 27, 2021
  • gshively

    Jul. 22, 2016

iOS 9 introduced multitasking, which allows apps to be used side by side on certain devices. Along with this came a number of new APIs for handling transitions between different screen configurations. However, integrating these new APIs in an exiting codebase can be trick, and often requires rethinking the way a component is structured. This talk will introduce multitasking, cover the new APIs available to handle different scenarios, and walk through some gotchas when adding support for multitasking into existing applications.

Views

Total views

1,022

On Slideshare

0

From embeds

0

Number of embeds

5

Actions

Downloads

11

Shares

0

Comments

0

Likes

2

×