Hacking with Swift Live 2021
My Xcode projects and sources created during Hacking With Swift Live online-workshops hosted by @twostraws.
Day 1
-
Various Swift 5.5 features and additions: Check out the code ContentView.swift
-
Message Inbox: Learning about the new basic concurrency features:
async
andawait
keywords, SwiftUI.task
modifier (as alternative to.onAppear
),async let
assignment andTask
struct to run/submit parallel tasks -
Practice Petitions: Writing a small app showing "petitions" fetched and decoded using the new concurrency approach
-
Practice Chat Messages: Writing an app downloading 3 independent JSON data files and displaying them using SwiftUI
Day 2
-
Message Inbox: Learning more about the concurrency features: Task
suspend
, cancellation,sleep
,TaskGroup
. Read the code in ContentView.swift -
Practice News Stories: Writing a small app showing news stories fetched from 5 JSON feeds, concatenating and sorting for display.
-
Heterogenous TaskGroups: How to handle tasks within a
TaskGroup
returing different types? Wrap the result in anenum
! Read the code in ContentView.swift -
Practice TaskGroup: Writing a asynchonous
loadData
method fetching data from different locations and of different types, combining the result before updating the views model. Read the code in ContentView.swift! -
Actor: What is an actor and its purpose? Simple examples in ContentView.swift:
URLCache
,BankAccount
,BasketballTeam
andPlayer
. HandlingHashable
andCodable
for actors, when to usenonisolated
andisolated
keyword and how global actors, theMainActor
fit into the picture.Bonus: Using
Task.detached
to run code parallely not bound to the same actor which the View might inherit from its properties! -
Bus+: new features in SwiftUI so far
AsyncImage
,.task
modifier (to be continued on day 3!)