Skip to content

Instantly share code, notes, and snippets.

@sarpsolakoglu
Last active July 2, 2020 16:29
Show Gist options
  • Save sarpsolakoglu/57b80ce7c74a19a1d955a7b6e658f546 to your computer and use it in GitHub Desktop.
Save sarpsolakoglu/57b80ce7c74a19a1d955a7b6e658f546 to your computer and use it in GitHub Desktop.
WWDC 2020 Notes

WWDC Watchlist

Tuesday

Whats New

Whats new in SwiftUI [27m] 🥰

  • The new App type so that a SwiftUI application is as simple as @main 100% SwiftUI app
  • Return Scene, WindowGroup is default supports all devices and multi-window. DocumentGroup, Settings.
  • New multi-platform template for SwiftUI apps in Xcode
  • Launch screen config in .plist
  • SwiftUI is used for Widgets and Watch complications
  • Outlines in lists
  • Lazy loading grids for CollectionView like behavior
  • Toolbar modifier to describe semantics and for platform it’ll decide where to place in UI.
  • New Label type icon + title
  • Keyboard shortcuts support
  • ProgresView, Gauge types
  • matchedGeometryEffect ❤️ for really nice Apple Music like transitions
  • listItemTint
  • New Link ❤️ view for deeplinking and opening link in web

Whats new in Swift [32m] 🥰

  • Code Size decreased from x2.5 -> x1.5 obj-c code Swift 4 -> Swift 5.3
  • 43% Reduction in SwiftUI binary size 5.2 -> 5.3
  • Swift overhead decreased A LOT
  • New diagnostics system for precise errors and warnings ❤️
  • Code completion speed 15x ❤️
  • Code indentation improvements ❤️
  • Increased robustness in debugging ❤️
  • Multiple-trailing syntax { } { } { } 🤔
  • Use key paths as function type in Swift 5.2 (Used a lot in Composable Architecture) ❤️
  • Unified @main ParsableCommand, SwiftUI, UIKit ❤️
  • Implicit self, define in capture list and omit in body { [self] in selfFunction } ❤️
  • New do catch statement for error pattern matching do { } catch error 1, error 2 { } catch { } ❤️
  • Synthesized comparable conformance for enums
  • If let and switch statements in SwiftUI blocks ❤️

SPM

Swift packages: resources and localization [15m] 😊

Distribute binary frameworks as Swift packages [7m] 😊

  • Can use HTTPS to directly point to the binary, can also point to path.
  • Will need to ship with Swift 5.3 (Xcode 12).

UICollectionView

Advances in UI Data Sources (primer - WWDC19) [36m]

Advances in Collection View Layout (primer - WWDC19) [50m]

Advances in UICollectionView [9m] 😊

Advances in diffable data sources [11m] 😊

Lists in UICollectionView [16m] 😊

Modern cell configuration [29m] 🥰

  • Definitely check out -> Sample App
  • Good to Watch WWDC19 videos regarding DiffableDataSource and CompositionalLayout first.
  • ContentConfiguration and ConfigurationState are the new ways to style cells instead of directly accessing properties inside a cell even for UITableViewCell.
  • For custom cells can use UIListContentView which is a regular UIView so you can reuse it everywhere not just in cells.
  • UICollectionLayoutListConfiguration and how easy it is to combine it with other layouts completely changes how you would use and configure a list/cell, bye bye UITableView and thanks for the years of service.
  • Wish UICollectionView.CellRegistration API came earlier
  • Would probably use SwiftUI instead of UIKit if was able to use iOS 13-14, so don’t know if will ever use actually. 🤔
  • Some of these APIs use structs with closuresinstead of the delegation pattern, might be good to look into for our own APIs
  • [image:86B234F7-5492-4306-930D-3FC95234A584-2823-000006CFF7784D07/image.png]

App Clips

Whats new in Universal Links (primer - WWDC19) [17m] 🙂

Configure and link your app clips [23m] 🥰

Explore app clips [20m] 🥰

  • Primer is more of configuring the site association correctly, still good refresher if didn’t look at universal links before.
  • Sample Code Fruta App
  • 1st setup app clip in app-association file, 2nd setup entitlement, 3rd setup app clip as different target, 4th ship the app clip with the app, 4rd configure the preview on the app store with image, title and subtitle.
  • Can setup multiple app clip experiences.
  • App clips team was one of the more diverse teams.
  • First woman engineer in all of the videos watched.
  • Great tool for app engagement but sadly no usage for me currently.

Widgets

Meet WidgetKit [23m] 🥰

  • Widgets are not mini-apps, they should be glanceable, relevant and personalized
  • WidgetKit -> SwiftUI
  • StaticConfiguration vs IntentConfiguration
  • 3 size types + 3 view types placeholder (empty), snapshot and timeline (series of snapshots)
  • StatelessUI -> deeplink to app when tapped
  • Use system reloads to update the timeline through networking, environment changes or app based
  • Intents framework is used to configure (SiriKit and Shortcuts)

Other

Meet Nearby Interaction [15m] 😊

  • Sample Code
  • Fun new API, curious about what people will build with it.
  • Needs U1 chip and iOS14 so pretty limited use currently.
  • Need to exchange device token with some other API between devices before starting session using it.
  • Can have multiple sessions between multiple devices.
  • Works best when device is in field of view, doesn’t work well when phones are in different orientation.
  • Need to manage session correctly for pausing/termination etc.

Wednesday

Logging

Explore logging in Swift [17m] 🥰

  • New in Xcode 12 is the unified Logger in os. It takes in subsystem and category parameters to distinguish logs.
  • Log message is not converted to string and is optimized for performance
  • Can control privacy of parameters passed in so they appear redacted in logs
  • Can collect logs from Console app as usual, prints to Xcode console as well when Product > Run
  • Has the Debug, Info, Notice, Error and Fault log levels
  • Persistence of log message increases with log level, Debug is not persisted, Info only persisted during log collect , Notice+ is persisted
  • Debug level is very performant performance decreases through levels
  • You can use formatting as well like precision

SwiftUI

App essentials in SwiftUI [15m] ☺️

  • App -> Multiple Scenes (Windows) -> Same Views
  • @StateObject property for owning state in App
  • @SceneStorage to store view state of scene
  • On MacOS different Scenes can be grouped into tabs
  • A bit repetitive of whats new in SwiftUI

Visually edit SwiftUI views [5m] 🙂

  • Simple recap on building SwiftUI views and applying modifiers
  • Still crazy on how a view that would take an hour to do correctly on UIKit can be done just in 2 minutes

Add custom views and modifiers to the Xcode Library [13m] ☺️

  • LibraryContentProvider views and modifiers that return LibraryItem
  • Nice to have components and modifiers to show up in the Library for easy insertion
  • Don’t need to run the project for items to show up in library, Xcode scans the code and adds it automatically 😮
  • Can also define in Swift Packages

SPM

Explore Packages and Projects with Xcode Playgrounds [14m] 🥰

  • Fully integrated with the modern build system
  • Using Playgrounds as a way of documenting the library is a nice idea 👍
  • New Build Active Scheme option for Playgrounds that when opened it builds the scheme
  • Build logs for Playgrounds
  • Can add assets to Playgrounds

Testing

Get your test results faster [16m] 😊

  • New Execution Time Allowance in xctestplan to kill stalled tests, it’ll generate a spindump for debugging
  • Parallel Distribution of tests can now be done on physical devices using xcodebuild

Handle interruptions and alerts in UI tests [11m] 😊

  • UIInterruptionMontitor will get rid of interruptions with default options but can be customized
  • New resetAuthorizationStatus API on XCUIApplication to test auth cases

Photos

Meet the new Photos picker [14m] 🥰

  • PHPicker built in search, zooming, multi-select finally!, selectable type can be specified 👍
  • Runs out of process of the app (Like Android) so no photos access prompt required! Only selected photos get passed to the app 👍
  • PHPickerConfiguration for setup
  • PhotoKit should only be used for things like non-desctructive image editing and photo library organization

Handle the Limited Photos Library in your app [14m] 🥰

  • Now when using PhotoKit there will be “limited” option that user gives access to part of library, this will be the case for existing apps as well
  • Without changes: user needs to go to settings to manage selection, or app will re-prompt to update selection after re-launch 👎
  • New status value limited to query with new PHAccessLevel for readWrite and addOnly
  • If limited can use presentLimitedLibraryPicker to display native UI to update selection
  • Set PHPhotoLibraryPreventAutomaticLimitedAccessAlert in Info.plist after to stop automatic prompt

iOS Pickers

Build with iOS pickers, menus and actions [20m] 🥰

  • UISlider , UIProgressView, UIActivityIndicatorView, UIPickerView visual changes
  • UIPageControl visual and functional changes like scubbing + customization options: backgroundStyle , preferredIndicatorImage, setIndicatorImage
  • New UIColorPickerViewController ❤️ pretty usual controller delegate pattern
  • Updated UIDatePicker ❤️ new
  • Compact style, shows calendar as modal for selection, time from keyboard
  • Inline style shows the new picker inline like the wheel but new UI
  • New UIMenu for adding to controls, default it shows on long press, can set showsMenuAsPrimaryAction on UIButton and don’t set primary action on UIBarButtonItem to show menu immediately on touch-down
  • Back button also shows menu of stack
  • Can add own menu interactions to UIControls
  • Use UIDeferredMenuItem for showing menu async
  • UIAction introduced in iOS 13 can now be used with new APIs.👋 #selector

iPad

Build for iPad [23m] 🥰

  • Multi-column Split View in iOS 14 ❤️ .doubleColumn style for old usual way .tripleColumn style for new: .primary, .supplementary, .secondary.
  • Set .compact for when not enough space (iPhone) and system takes care of rest 🤯 but this leads to two different flows for compact and regular so need to manage state when transitioning between these two
  • .preferredSplitBehaviour: tile for sharing space, displace pushes off screen, overlay shows others over seconday
  • Can use .hideColumn(...) and .showColumn at any time
  • Use .preferredDisplayMode = .oneBesideSecondary to fix the dispaly
  • UINavigationControllers are created automatically and buttons place automatically as well now
  • Use UICollectionView list type with sidebar style for creating sidebar in apps

Build for the iPadOS pointer [22m] 😊

  • Most default components already work out of the box with pointer
  • When updating start from top down with first UIBarButtonItem and UIButton
  • isPointerInteractionEnabled = true for UIBarButtonItem default
  • Can use .pointerStyleProvider to build UIPointerStyle for custom appearnace, it takes in UIPointerEffect, UIPointerShape, and UIAxis
  • For custom views use UIPointerInteraction and UIHoverGestureRecognizer
  • Can control UIPointerRegion for snapping to control for polishing (needs to be within the hit test of view)

Thursday

Widgets

Widgets Code-along, part 1 [9m] 🥰

Widgets Code-along, part 2 [15m] 🥰

Widgets Code-along, part 3 [9m] 😊

  • As the name suggests this these are code-along videos -> Start Here
  • NOTE Simulator in Beta 1 doesn’t work correctly so need to run on device
  • Add Widget extension target and add shared files like you would do with Watch target.
  • In the demo there is already a view that can be used as the widget, easily displayable in preview using .previewContext(WidgetPreviewContext(family: .systemSmall))
  • Widgets components: WidgetConfiguration which is either Static or Intent, it takes in the TimelineProvider or IntentTimelineProvider + the placeholder view for when loading
  • Provider passes in the TimelineEntry to the view of the widget to use as data
  • The .isPlaceholder(true) is used to convert the SwiftUI view directly to a placeholder view but doesn’t work in current Xcode version
  • TimelineReloadPolicy used to say when to reload the timeline
  • .systemSmall is one giant tappable area while others can use the Link API to Deeplink into app
  • Can do URL session requests from widget and use .onBackgroundURLSessionEvents to manage the background tasks
  • Can use the WidgetBundle to expose more than 1 widget and use @main there
  • Can use Intent extensions for dynamic configurations

SwiftUI

Build document-based apps in SwiftUI [12m] 🙂

  • DocumentGroup scene with type, can compose with other scenes and types
  • Can define custom document types in settings
  • Not very interesting for our use case

Stacks, Grids, and Outlines in SwiftUI [19m] 🥰

  • LazyVStack and LazyHStack that render content incrementally as it becomes visible on screen
  • Embed in ScrollView for scrolling
  • When outer stack is lazy inner stack doesn’t need to be lazy
  • LazyVGrid and LazyHGrid define GridItemarray and spacing, rest is passed in as before, can use .adaptive type
  • List is always loaded lazily
  • New children parameter in List to define Outline (groups) underneath it uses new type OutlineGroup to traverse trees of data
  • Can use DisclosureGroup to group inside Form , actually OutlineGroup uses this internally as well, composition at its best!

Swift

Embrace Swift type inference [20m] 🙂

  • A look into type inference in Swift
  • swift.org/blog/new-diagnostic-arch-overview/

Unsafe Swift [22m] 🙂

  • Does not do fully validate its input
  • Used for inter-op with code written in C or Obj-C, control over runtime performance
  • Don’t think messing with memory access directly with pointers and buffers would be needed in our usage

Playgrounds

Create Swift Playgrounds Content for iPad and Mac [8m] 🙂

  • Creating books for Swift Playgrounds for iPad and Mac
  • Watch the Swans Quest videos for more info

Build a SwiftUI view in Swift Playgrounds [14m] 😊

  • Swift Playgrounds can be used as a prototyping area when you create a Xcode Playground template, it’ll be ready to port directly
  • PlaygroundPage.current.setLiveView(..)
  • Can add new files inside didn’t know that, multiple tabs to edit multiple files
  • Can create a new view inside main page to imitate a preview and give modifiers to test with different environment variables

Testing

Expanding automation with the App Store Connect API [25m]

Write tests to fail [17m]

XCTSkip your tests

Push Notifications

The Push Notifications primer [11m]

Saturday

SwiftUI

Data Essentials in SwiftUI [36m] 😊

  • Recap of how to use @State, @Binding, @ObservedObject, @EnvironmentObject``@Published
  • @ObservedObject view does not own it and does not control lifecycle, all views will update that are tied to it when it changes
  • @StateObject new in iOS 14. SwiftUI owns the ObservableObject, only instantiated when the body runs and kept alive for the view lifecycle. Example for this is an image loader.
  • @EnvironmentObject is passed as a view modifier to parent and can be read deep down in a child.
  • onChange, onOpenURL and onContinueUserActivity new event sources addition to onReceive
  • New SceneStorage and AppStorage to restore state when app is killed and restarted
  • SceneStorage to store things like current list selection
  • AppStorage uses UserDefaults to store things like settings
  • Point Free makes the point that it is very hard to have code that is testable by using the vanilla approach, Composable Architecture series gives a very good background for this

Build SwiftUI for widgets

Structure your app for SwiftUI previews

Performance

What’s new in MetricKit [13m]

Identify trends with the Power and Performance API [15m]

Swift

Safely manage pointers in Swift

Testing

Eliminate animation hitches with XCTest

Other

Build scalable enterprise app suites

Build localization-friendly layouts using Xcode

SF Symbols 2

Boost performance and security with modern networking

Become a Simulator expert

Background execution demystified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment