Pro Yearly is on sale from $80 to $50! »

Build for iPad recap

Build for iPad recap

集まれSwift好き!Swift愛好会スピンオフ WWDC20セッション要約会 @オンライン - connpass
https://love-swift.connpass.com/event/181458/

YouTube
https://www.youtube.com/watch?v=9PNw8t5CIFI&t=12180s

0b26590a0a8b0f1da140ed5de9b68379?s=128

USAMI Kosuke

July 09, 2020
Tweet

Transcript

  1. Build for iPad USAMI Kosuke 1/25

  2. ࣗݾ঺հ • Ӊࠤݟ ެี • ϑΣϯϦϧגࣜձࣾʢେࡕຊࣾۈ຿ɺݱࡏ͸ࡏ୐ۈ຿ʣ • Mobile Act ओ࠵

    • Mobile Act ONLINE #1ʢ7/22ʣ • ొஃऀɾࢀՃऀΛืूத • iOSDC ݪߘԠืΛ࠾୒͍͖ͨͩ·ͨ͠ʢࣥචதʣ 2/25
  3. iPad ΞϓϦͷηογϣϯ ͜ͷ2͕͓ͭ͢͢Ί • Designed for iPadʢiPadͷઃܭʣ • Build for

    iPadʢiPad༻Ϗϧυʣ ଞʹ΋ɺApple PencilɺΩʔϘʔυɺτϥοΫύουɺ Catalyst ͳͲ΋஫ҙ iPhone ͱ Mac ͷதؒͷσόΠεͰɺߟ͑Δ΂͖͜ͱ͸ଟ͍ 3/25
  4. Build for iPad • Multi-column Split View • Lists •

    Reducing modality 4/25
  5. Multi-column Split View 5/25

  6. Multi-column Split View • UISplitViewController ʹଟ͘ͷ API ͕௥Ճ͞Εͨ • ࢀߟ

    : API Document Ͱ͸࣍ͷΑ͏ʹݺ͹Ε͍ͯΔ • ৽͍͠΋ͷ : Column Style Split Views • ैདྷͷ΋ͷ : Classic Split Views • iPad ͷαΠυόʔͷ࣮૷ʹ࢖͏ 6/25
  7. Multi-column Split View 7/25

  8. Style ࢦఆ let splitViewController = UISplitViewController(style: .doubleColumn) let splitViewController =

    UISplitViewController(style: .tripleColumn) 8/25
  9. Column ໊শ Primary / Supplementary / Secondary 9/25

  10. Column ࢦఆ splitViewController .setViewController(sidebarViewController, for: .primary) splitViewController .setViewController(indexViewController, for: .supplementary)

    splitViewController .setViewController(myHomeViewController, for: .secondary) 10/25
  11. Size Class ରԠ • φϏήʔγϣϯͷσβΠϯ • Regular : αΠυόʔ •

    Compact : λϒόʔ • UISplitViewController Ͱڞ௨࣮૷ splitViewController .setViewController(tabBarController, for: .compact) 11/25
  12. Display Mode 12/25

  13. Split Behavior 13/25

  14. Split View ͷද੍ࣔޚ • preferredDisplayMode • preferredSplitBehavior • splitViewController.showColumn() /

    hideColumn() 14/25
  15. Lists 15/25

  16. Lists • ҎԼͷՕॴͰ͸ Lists Λ࢖͏͜ͱ͕ଟ͍ • Primary ViewʢαΠυόʔʣ • Supplementary

    View • ࣮૷ʹ͸ UICollectionView Λ࢖͏ 16/25
  17. Collection View setup • UICollectionLayoutListConfiguration ͕௥Ճ͞Εͨ • appearance : .sidebar

    / .sidebarPlain let configuration = UICollectionLayoutListConfiguration(appearance: .sidebar) let layout = UICollectionViewCompositionalLayout.list(using: configuration) let collectionView = UICollectionView(frame: frame, collectionViewLayout: layout) 17/25
  18. Collection View ͷৄࡉ • ͜ͷηογϣϯͰ΋ղઆ͸͞Ε͍ͯΔ͕ɺCollection View ͷͨΊͷηογϣϯ͕ผʹ͋ΔͷͰɺͦΕΛݟΔͱΑΓྑ͍ • ࠓճ௥Ճ͞ΕͨҎԼ͸αΠυόʔͷ࣮૷ʹ༗ӹ •

    UICollectionView.CellRegistration • UICollectionViewDiffableDataSource 18/25
  19. ·ͩ UITableView ࢖ͬͯΔͷʁ If you're still using UITableView, we highly

    recommend you switch to UICollectionView. ΋͋͠ͳ͕ͨ·ͩ UITableView Λ࢖͍ͬͯΔͳΒɺ UICollectionView ʹ੾Γସ͑Δ͜ͱΛڧ͘͢͢ΊΔɻ • αΠυόʔରԠ͸ͦΕʹͪΐ͏Ͳྑ͍ͱࢥΘΕΔ 19/25
  20. Reducing modality 20/25

  21. Reducing modality • iPad ͷΑ͏ͳ޿͍ը໘Λ࣋ͭσόΠεͰ͸ɺϞʔμϧදࣔ͸ ద੾Ͱ͸ͳ͍ • ྫ : ϝϞΞϓϦ

    • Color Picker Ͱ৭Λબ୒ͨ͠ޙɺPicker Λด͡Δૢ࡞ Λͤͣʹઢ͕͔͚Δ • Color Picker ͸ࣗಈతʹด͡Δ 21/25
  22. Reducing modality • UIKit ͸ Popover ΍ Menu Λࣗಈతʹดͯ͘͡ΕΔ 22/25

  23. Case study : Shortcuts 23/25

  24. Case study : Shortcuts • γϣʔτΧοτΞϓϦͰͷ࣮ྫ঺հ • Multi-column Split View

    • Lists • Reducing modality • Regular / Compact ͷ੾Γସ͑ʹ͍ͭͯ΋ղઆ͞Ε͍ͯΔ 24/25
  25. ·ͱΊ • Build for iPad ͸ಛʹαΠυόʔͷ࣮૷ʹ͍ͭͯࢀߟʹͳ Δ • Designed for

    iPad ͱ߹ΘͤͯݟΔͱྑ͍ 25/25