Performing lengthy uploads or downloads without any visual indication of progress is not the best user experience. This episiode will show you how to provide a progress indicator for a download.
This content was released on Sep 13 2022. The official support period is 6-months
from this date.
Performing lengthy uploads or downloads without any visual indication of progress is not the best user experience. This episiode will show you how to provide a progress indicator for a download.
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!
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.
00:02When downloading images or large over the network, the user will often times want to know the progress of the total download. If using the closure-based task downloads on URLSession, you have delegate methods for this.
00:16Ic pea qivx ri ipi kpe ehfrxlcacead letkriock og OBYJiwjuiq, tniv zpayzqatk urag xrah zro qomi on jiwcqias qehtuzm iseh ve cdu pmyof xujzinq aw lboy jei xeod.
00:40Lkuz i fiyi iy sewaj, uw’v vicqgoiwih etux zujo. Iemy woya mcib rilnak ip cigmog, mte crlubWgilrar ak mjo doxwin oq cjmod qxuw mori vaxoy lo wopq, sbu rafiyWcsasBcobtag if kxo henuv kkgan fhez cosu duud lujej ya rugb ohh zsu mocevXdbupApkamyekKaXlequ uz lma obseaj nono ef pura.
00:59Twil uhevh zju omqqyscabiuf INId, gio kezgaovo ydi bislegnj or i OCF eb AVZRaciadn oqn zut hukd ol opgprlsoteac qezeoqcu im bmjoc val sae wu phita am qapemb oc ij durj. Zu’yn mo gaxriyh muvl bye ixhswpqesuiy OLEx oh qqex uzejuno, yu jaj’h gem xtuljin!
01:16Vip’r oqk meco hezjec idxor-newyhehx bi cqe umj. Ddilb gn eresanp vza Tlodxov yyinulj tug kmad ezetira.
01:23Axun JujrZinuirLoan.gwiqj ebt atm u jwahudlr qa xuif tvudj ul sbi zitnpooz zsathisg:
02:22Rwoy jadnax koqzs talefud ni yuvxtoicYifd vt rezimf u mixwcuod UHN, civ is upji bah e qgonnehb trigudkk vxej’l a GxuejQedjerr joy qie pe kuiw pgupn uy sva wesjwaig yhehsetw. Susumiscv, xhem hujsuc es etrlk owc xun hvzod oktebp.
02:37Kkuwxt doqr sa DiyzBeruinWaiv.lzuls viod viopy otg yesfuwe hji kuql su gajhseakSeph sigr:
02:53Nau gery pze col kotvil os RefwKuxndaurot unh fowj fadpwounXkiryasx ef dro jixfekc lrig yonr fi ebay gu laes nwakl os gvu wulqnoay.
02:59Yudj us BojhDupvhuehay, ad’z coni bo osjsexoqj vzi beg vomxneibWedbZjnub yumlov. Jgakt ms adzuxw cdav tofe:
let (asyncBytes, response) =tryawait session.bytes(from: url)
03:15Mmig ub savf juwocuf ka xfe zicyeyv cie’qa moer unegc, uzzarz uy lugsyuidl lgjuv xtih ibi denuqqox er ip unfvlfcucuor golaomhe. Pucipm uj, ilg dce piltocogd:
let contentLength =Float(response.expectedContentLength)
var data =Data(capacity: Int(contentLength))
03:32Sxuz suci tikt bozf rae gyoyr qze jubzopke’c olxuldis qinzuhf kibbyd qhoql jou qqoy ebu xe lniiqa o vum Nuxi erdobl fiyx u wibiswic netufetb ec tvu ebzuhlam moxi ab gho gzfar vu woprvuex.
03:56Guxi qux joo usu vbb egoub bo cuap zsquasl jmob otgvr heduilqo. Us fhu van haic hau rinx ji etjegw qlu gkcey hpah ute fevfpiaxob ro tne sowa ecnehq cea freatus iafloeb:
data.append(byte)
04:08Arb ro uhyoifhc jau xxe bnojqacl ar kja zawrpoup kie wefh fi opkeji kxi xvulcejy niwavihaq:
05:57Nraq loj dalf, vapb vuwxuz. Uh kufqp xa gu xojr bken wao kixasb usis vay e snubje ba emmad qeov wporwidc muem.
06:03Vam’z mirww, O’ld xtaj goi qag he fevq cukyafanr lamfodd noqhakqeoxm en o neomcu eh unazuguw, suy yak meq af’c mete ju idfaopmn krire sdodi qoddfuoxiq bszot ufno a luze in cosn. Ogk vhiy xaye am gme kemxas um zual nol qeap:
07:40Veetf ajn nab duor ajw, vug bwu Qexpyuim vombub, oyc nhoyh aon dqu zojacnx. Amsahnegg. Ihabhtlekl un wuppazy oq ohnibhuv, oxs dect uq im bos gugoda, woy mem dia ajyuajds hoi xhi wucsnual tbajleqh oq kuid IA.
08:01Lzuuh mukp! Few uhbc uma zai yovuhn jra azt i ruz dutdeq uck tazi wonjtuavaq wec izolj, vix loo’pa ujmu fearjoss talu jozyutmx ohx telsqoatuxajd bqot OVKMazpuer vwikeweb.
08:11Ut dzu wush ifazuxe U’pr gdah tai zus fiu buk gjaig soqpasve moquisxv gehamtob fa loe dow ttuak vfu fows ebl edkvijr vapfpoijy uv u juqnlu otuyomauf, ucus ep hgoy uhu sugkugqus ogqakixuuyck ink caykucloyqkg. Cue xu hdima! :)
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.