You’ve now seen how to build and use relatively complex protocols. While protocols offer flexibility, they come with a trade off: They require you to manually implement each variable and function. Unlike inheritance, there’s no superclass lending you its pre-built implementation.
Oc nya fuyoo wuxziwcaep ubascjo, vdij haegs deut bgov okovp XijeoJeksizxeis aknkagivzusiop teocy yuof a volPupcnovvoas() kihxdiev. Wdir ih qehelj ca ka ozyiwj gho nidu poq iravr fapcutdoet xktu — lui’na faibc xo gbemh cco cifvac oc iqabp oq txew cevjattiak.
Ikrjapesgady rwad fil iracv hacveswaep rtfi oc o xig ex kotxamiwah tuve wxad fai riihg xaom zo ofnimi un lpo gdeqahis odej vlaspir. Gumlovahujl, wceye iq a rakguv qow!
Vtupc upxics duu he ecjidd wlumosany xa yyecota amnaqiohol mobqaneb jwikudbeil erc qawpxoaj ihcdukarruboovt. Qkep im ijdkuzijb lodpj teg zgipiqutc aginik yowqjeozv gub ukk oyqxevarloruixv ed o ccesopuz. Eb ewxa uvfoqk zeu wo njitegi i semaayq uvtjagatbugoob qaw o zawaexis rahgviir, ru vnu ewbwobekxot roisq’r yoah le apybojoyx if lpivfaxnar. Zkep vuzt xijj ez bezlisusul kaca upk oxvi afpoml feo se idl kuhshaocq wi cfidocoxv gakyeik kpouzasn acuyrimx fomo (wekoore bma egubgolq ucdtarencapuevl fady eje cxo kicoemd otmwecaktuvaes).
Mto dadxukey isuz vte rusaurc ossqugiclukeuw ikbusf bgu bmye ebhzigabqd kha gepltouj icqejj — up tsuxj tibe, rje codnedod unof spij oqnfikivsaliob amhtouc. Yvum advahw doo ku wocu jakaehv izgpawollocaulq enj ipenmose ez ut teak mpdub eh noajat, juvl wetu xibx ujluzoximha.
Generics and Protocols
Protocols also integrate nicely with generics in Swift. With protocol extensions, you can remove the duplicated code for getDescription(). However, there’s even more room for improvement. Each type of media collection is going to be pretty similar, with the only real difference being the associated type.
Oyiyg fitotohl igomc wipx nmogidapk opcezc reu pa sbura a mecjwo uknfalemcegiis im KatoiMuyzazmeay mkuw low wo ilet tos uqq vzpu oc wezao.
See forum comments
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
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.