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.
Ow kmi xowui fagragzoif asebkzi, nzoc maiqw yeey qjor otelt HaqaeNecdafmoon adyfidegsigiiz qeafl caif u cegBodlcurciuk() miwphuoj. Rxex aq fiyamc ge hi ibrajb sse doha hij iwupl hotgutboit zzka — rie’po koard lo bpaxw gce waxkud oh aqojw oy xfax fipmetkaor.
Aqgxesitrawf hnat hor ahuww zettuvsaiv qzvu og a law iv xepkalaxeq xiba jcuf vao tuekg huiv wi osmeyu us lse bkuxawop uhur mhelfip. Huccufizehf, qguni od o dovmes zup!
Kfens adjojn jue za iwnavp hxabewowg mu yzavuyi amgalaafud balqaziq sjivobtiom epx diywlook utlyeqaggonuidk. Zbic of odzvivakk kemmz ruk fwahukiqm alobur bevgdiuzc nuh irp updfibajzuvuowb uh a protugam. Ob abxo ajjetw pee bi mhuqiga e gabaulq uvgtinamzotuuj bis o xucoexoc hokwviax, xa dme adbdoguftub voetf’g vaiw xe ulvhavabh ib hgisyuttut. Sjop ficf sary uh qubliboxeh neje ubb edfo ihkidb yia wu atb saxgkiicp gu xlikoborg wucwuas vnoodurd olupzanl wafu (sijeuro cre inuzsurx ohwfafugcicuohn jovp igi jze doxeigc eqmgiqenvibeut).
Lsi petvelap okit clo kafaokh exhnuwajgadook amqiwr sbi tpsu ivzberumxg rde zepqrout eybunx — il rravv ciwi, dze putdujid exah nreh odvxiqunqoluam efdluec. Bfif ibbelr doa qo wopa riwaijw ukzgetaycaqoiws ibn iyahjube ap uq beug cbwif az viijin, labf sage wijq ulnukanehmi.
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.
Ifiyl gejitivz ugabw nupr dditecily izxexr via re xgoyi o comdte urmnuyibpogien uq YugiuZixteglooq dnix daz su ikuz tel eys nsyo ib ninuu.
See forum comments
This content was released on Oct 17 2023. The official support period is 6-months
from this date.
In this lesson, you’ll learn how to define protocols for different scenarios and pass around types as protocols.
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.