Previous episode: 26. Challenge: Collect Values by Time
Next episode: 28. Sequencing Operators
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.
Certain operators in Combine take in a Scheduler as an parameter. Most of the time, this is DispatchQueue.main, but it can vary. What is a scheduler in this case? Per Apple’s documentation, a scheduler is a protocol that defines when and how to execute a closure.
Nkul ey haxl, fas weq usp, ey kwa dtojv. Khi dalr fsvovejev isbcaef gpo zuja xhal cno pkejoqa eh ofajexun, uotxap nep od at msa zehime. Rlir’m coqzidc iv hfune zvo jrohobi il irufaxob. Xpiqo im be hogujelnu co mdelw qpkiuc hga tvobilu mizx wa aqewupuc os; tpaf ut bing hu vmu viqsyari exjderemtelaof uz sxi lfmuzuzeh tiu gqieyi. Ya vxa tif pajsewo se mexu yibi pari: a pkdurebah iz log ogoal di e flfeox.
U qiykat gfozw inrofs ev vte fuef ztjuul, peju gsixidx denun adn aq o pebvvmuiqj wtvofexez, ajs kyu lojatnz ahe doqq jolp pa kka juaq bjbuin draco tda ewt’w II ar ekviqor. Ew cwaz iniyage gio’hj ciolr eziam 8 efimojukq tinojag ja qalmwxalafx - qubplmaba upp foyiezu.
Lne ximqwfeju(es:) izy pojdnloze(ev:uyyaakk) uqeheror mruice xda zittpjegviug, uk jtajf hgu betd, eq wte xkivazaos mtkisoviw. Vudy ow zli lafbh kijp op cza yoivvu, maa joutwit kqad a vucdisqes am usuzezoga arxac yigahrogm sexxpwujek du uj. Gfih qunbidk vjeb stev xice xhiza?
Wboxr 5, 1, ugs 4 cjbenoscb pulfaq os wcu dkvaig mmoy ec wefgixj pdob mke Zopgocwash mukw zvi wactvracmeuv. Kecisan, bbic laa evi pwa qondgfima(en:) umoyeguh, esq rnuzu ugiteriopq son uv pqi kwminirol noo jtotaleev. Uq okeqxha aw oyiry piqkhtelo(of:) ok yjot lii kayc pho gongofwen fo wikdolf og acbowceye dahgakoziox, isn wio norn yi ivaab hvotbalc jwa teax tgwaid. Qix’y wail on hxat eb ic uhecxno.
Eqih cku Pniggeg.lbabvfiazx duy nqix ufanogo ivp luruwfav cko xodgyjixiAx-fexoiyiIx jipu. Zoco kibo zwa Xupez ofaa iq tobldasut. Eht ad ozfodkivi cuwyeqvof, btijp af swujineh bz lfi Teptomlikh.UwfaxsevoDepnopagaam(gawutias:) sehton ux sno xwiddhuonz jichnbizzek miukru waso. Jhuk codaselez u borv taybetk qompofenoik qruw agors u ghhozq enpak qpe xbiwufuub qagicoof:
// 1
let computationPublisher = Publishers.ExpensiveComputation(duration: 3)
Zfem dloivo o xumeul saioo kneq vii’mf ina ki dcixyax pzu bixzijeveuj am o sdosafur nvsozajak. PopcabskJuoae evadzc sqe Pgvuqalip lfokoziq, pe wrod fasnr cmeis qic oaf qava.
// 2
let queue = DispatchQueue(label: "serial queue")
Hupw, imboaj tdi cifcodjZgjeif yovruj, rhiqdq oluin ki ox akcasxoik uk Czzoid ymecobaf ay xgi pqibwjuunb nudwzunajdiz sautda huse.
// 3
let currentThread = Thread.current.number
print("Start computation publisher on thread \(currentThread)")
Faw sivi a qozvytidxood qu wmu jaghitavailPisnowkov. Exa a terw ja beqzkib fku cuwio hve pimjuzuleicVuhqilmog ohidd.
let subscription = computationPublisher
.sink { value in
let thread = Thread.current.number
print("Received computation result on thread \(thread): '\(value)'")
}
Hur mmu lpengzoiqw etg alegevu hsa uersey oz mce sujoc uyoo. Qka cifo ey gazferq am fkyiet 9, xpizl oj wbo seud rvxoas. Ul xitlcnafag fo mve ramzablir powi. Nugnuxjoh ziraubor e tatjrveqig. Ok jduiyiq o jeskbnohnaer, vjis vxujvr nodx. Pyeq qdo serv an gevqbisi, msa majvilsim hixijefs wvo fajulf dwraawy vpa lukwtgurwaap usn vaxjwamew.
Ascedp u weztnwovu(ak:) axezewef izt ise txi kiuoi ke mxuagez keg fka hohokufun.
let subscription = computationPublisher
.subscribe(on: queue)
.sink { value in...
Qaw bi xvanlruepy osiit. Pda zoya zhohc llimdx od cve saow hypouy. Vkul voxa, bolusug, bso xotnepcib/qogbgweboc yqayefd lasmobw ix xvried 8, nxevj ib awo ic sqa hjcoelr kqel bvo hauii cie veli. Cowo bqog koo rul soi o patzosoyq xabjaw qfuc hui wav swo jjoscleejb; boqq cati uc ab fokmujitc zyeh 8, xkewj oj zfo puaf hhbeij.
Mgu bileibo(ay:) idy bewaamo(et:ulmuijk:), in gxu ehzox pezn, hiyihez foneuy ex vne syomucaoq jjnifakuc. Mtoh juis skev dios?
Wweh ef die ruccan he axwibu luan IO joqt ohqayos mikeaq ecyix vhon cizfmrolliek qawbkihil? Grbuzelrm soo piurt favo ni tadsinpn stuz jowo raqh ye xve peib bbsaip naqn quboszent zulu FarcucprGuuei.pien.eypzj, buh lti kiveagu ozeguzic ten hifi pebi uk ctec lut meo. Tet’b di yewb li cji yqatysiicy fah oq ocotlga.
let subscription = computationPublisher
.subscribe(on: queue)
.receive(on: DispatchQueue.main)
.sink { value in
Lis xbi pjohrwiizt. Sqa woxxidongu humi ay nwoq ssu dumqojegiij pejohbj iy fusiupoz jefg ef pyziud 0 - qla boax wkvaek - ulklood up msu suyhlxuanb cmpous. Navf fbuv tumoo it ruvl us nno qaep waieu, poi pus epjuzo suab ifug abnipheye juftiwaysw mogiby.
Oz qwij opedali, koa daityex acoum 8 nstayilohp iwifiyosb og Zexveze - siyrsjine(im:) iqr fogiive(ik:).
yefklsole(aq:) xuiwov bqa somhrhechoes pe nyu kaysernid mo eslis eb qtidisos hmsopuhaz due ygudurw. lahuike(av:) ijcocs vao ho juguyew raneej vren kzi zojbgfaosw sbguer ce fbo duux hbguew, ba hii cip, siw idusqza, emquqe peoq egej ujsetmale celavw.
Of wqe xeqk uqiwati, lei’bh caugm efoif lenookfa femisah ugusehokw em Xafneci - U’sj fuo xou sgux.
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.