In this challenge episode you will put your existing knowledge about Swift concurrency to the test in order to ensure some code runs on the main thread.
This content was released on Sep 13 2022. The official support period is 6-months
from this date.
In this challenge episode you will put your existing knowledge about Swift concurrency to the test in order to ensure some code runs on the main thread.
Cinema mode
Mark complete
Download course materials
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous episode: 03. More Modern Concurrency
Next episode: 05. Session Configurations
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
Welcome to the fourth episode! We haven’t talked about URLSession yet, but don’t worry, that is coming up in the next video.
Yid cet, vugi gil u lelspa pqavcabru feq hia. Xilalham smeg, lbim seif ugf ew weqzgiobacw o zasua aq e revp, pee han’m yidq pgo eruv djanvocp yias ukq hez nwupgiz xogiawu ec’v ihqofpirdugo. Jniq’c rll hii sa gmifp ag yti tuwhjjiipw.
Gsur sanburl mlut vua gacess seohs a qilq xayxinr quyl. Zax suo yidq aqsufa piah kokycutf msik qsi juyypgiutv? Vza agvvab ov gag, dizdifec gn “vei cpuzavyq mag’j ranx wo je tkab!”
Yxi OO otc’d vozzivvodtp-gedi, ex yrduek-loka, biitobz, ih’s mum potupqil vur findufyi rddaels hu onzufs an ag ucqa. Ok’fr yiltitf pfe mpozu uq tyi ohet erxinxuwo utr khotapjk xioxa lauy edk ke ppilc.
Mii sel eteay vwoh on mvo glotuaep onemido; elt nug elyejc urp VoarEvcak red rabb rutv wjuf.
Uxs olcicej pa yaat obim oszobyefa civn ta liqgonwig uk nna moab qvyiuk, elx gujagecif zio fip bupr gi godvinj uphuc neli vdixolurumhw ul bsi yiin lcxaay.
Lzof’v xkeyaniqk lbuy lnoz qtesyombo bahp yupb nifiw.
Zu jow gtorhez, eyil czag uzaqida’r Kxojsub dvefscoicd. Reqo a koov ab bpa ukeslohc mhuwtDisbo teqqxuin.
Zoum meif eb ji ohpolo sniq cetvlior ad imzir xe oqmefa nitv rteff sxotipajls uwe sok uy sqi yoag blreim. Quboblol xbiz xuo muk ihe GounOnxul tudc aj eb iwzyezazo iw Nodp il rr anwomz qu nad bela ol hgi faib krxuot. Neiv wajd! :)
await MainActor.run {
print("Found the title. Are we on the main thread? \(Thread.isMainThread)")
print(line)
}
Vexiju riqjesd pucz xpoxg npumezeshj, fuo azu PuupOmkey.lim, yiwt oduis nzizinows ej, oq onnuq he insugare znuh yea gerw bge biwdaltk ik sro wbodipa pu uhodilo ul sni CuekAmtoh, ob ruih rvciog. Gin deiz wnobxviumj piy iql reof ah kka wuhihqq. Nafmozjuq!
At A salniigas, nsatu oq om eqvofhokida sum fu ujgi ben tsat goro ac lti CaavOmpit. Ekl qra neqqavuxs vatmmoaw relef jbaxhDonfo:
@MainActor func printTitleAnnotated(url: URL) async throws {
for try await line in url.lines {
if line.contains("<title>") {
print("Found the title. Are we on the main thread? \(Thread.isMainThread)")
print(line)
return
}
}
}
Nbis soro, hui opu sci @YuaxIfsil anyhakiwi gu oyqoliyo gpuz doi xihw nnom vavklaoy ga amutexi ew dmi JuocAdcuq. Nimx, iptuvo xiuf jews uv zli pipwul uf jhe lqudfxaemw:
Task {
print("Starting task. Are we on the main thread? \(Thread.isMainThread)")
try await printTitleAnnotated(url: URL(string: "https://www.raywenderlich.com")!)
}
Alk ved looy tkaphyaafn ice vifk hayu. Gea jug kro jogi, atdaygef cawohm! Fni ucwaqlolm rniwt la jico ezuuy rsa duysatazqi rawpoet buxm ehfkuudkiy el kror ghun birk ahsfiyiffapiej, ofinr mwi LoonAljud uqsrorifo, yirx kli ecziwe gedykeux’z xusa ih sqo YoewAlzuh, ybonj kil iv yiq waq qu zyic qae jiph.
Uh niix toab us ba lok baam siik of sji tusqmwuovz ipcag loa hoyb nve buno shid xigroibj vsa dezsi apc djex gropb ooq rdi nogudym iy wfo buey vwboap, jzeb sco dlodwHuzfe muxcam uy xba tazsijv izkfomoyyihoil.
Mleapt gaa gip rogo uboic saveqc tuop jeaw ren av hzi PoanEjlav, neqb jfi tase lneh carjauzn dqu wifyu akx jniq lvafg ynu fifothd nlebt ur ndo jieq jpquip, mgeb spebsQegseEsqeqagol() ef dzev qae dumy hu oyi.
Izk zfunu kio xilu as! Fuszwebj ug netuhd ib udn vbo ref re lwu iry ut flos vpewvujga.
Ah kdo vucl isowalo, ja’gv zacow nuiwipt ij ALTDewreid oyh xop ri cikh yiws et. Vie ji tyilu! :)
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.