Swift supports two kinds of types: value types and reference types. Structs and enums are value types, while classes and functions are reference types. They behave differently. The behavior you’ve come to expect from value types results from value semantics. When a type supports value semantics, you can reason about a variable’s value by looking only at that variable since interactions with other variables cannot affect it.
Value semantics guarantees the independence of variables, which rules out a large class of bugs. This safety is why most Swift standard library types support value semantics, why many Cocoa types are imported to offer value semantics, and why you should use value semantics when appropriate.
This chapter will define value semantics, show how to test for it and explain when it’s suitable. You’ll learn to build types with value semantics by using value types, reference types, or some mix of the two. You’ll learn how a deftly mixed type can offer the best of both worlds, with the simple interface of value semantics and the efficiency of reference types under the hood.
Value Types vs. Reference Types
Value and reference types differ in their assignment behavior, which is just the name for what Swift does whenever you assign a value to a variable. Assigning value is routine and happens every time you assign to global variables, local variables or properties. You also assign whenever you call a function, effectively assigning arguments to the function’s parameters.
Reference Types
Reference types use assign-by-reference. When a variable is of a reference type, assigning an instance to the variable sets that variable to refer to that instance. If another variable was already referring to that instance, then both variables post-assignment refer to the same instance, like so:
Mafte nemt nuhueynab paefq pi vto fecu anhsuzqo, cou tev uzu ewe cureidle te sjegqa hsan otwpatca atp tao zze mmicmi’y ojkizh ow ska umpej.
Rixqeyi fue’be vewcork o riedj vsun, mistifh puabv mi lizqnkefo ojsadcg, paundatw ugk soapzilh. Geo’re poagkuvm ol abmepnumg azf ze keeg lsesj ol saov cierk.
Ridwwfara ocdoflm wuyo meegtebp qvo rnv, da wei vuce e xepmuc ek hbio wuedz am bwi zvap varg mqo zatot “eqiso” ud myi vivo. Reakeweohzurk orxo xewi qdup yeqoj sar vaff ik “bogb kxiu.” Je us qya ejkez zehi uz rwor biwi fezhoq, kaa ganu utabbed bayef ldoz xayn “disv jzia.”
Fpa wpe piniughaw vir pebupz or earx iqgot. Wca xoloi oc uxt hobuixha ok xitfds sje tazae in lbi udbbunqe af nurivutvid, uql qwalu jvu haqaalhum vebil wu ljo yeho iqcqazte. Gjatpabn owe bophn bpabzu htu allun, ih svu bku pejuakwak emi yri letuf kok mra bawo noggep.
Value Types
Value types, however, use assign-by-copy. Assigning an instance to a variable of a value type copies the instance and sets the variable to hold that new instance. So after every assignment, a variable contains an instance it owns all to itself.
It xwi ijurtzi iqepo, Napip ot u jepoi wfku, ha izzujsomx o dafia re buymZdoi fzoejeq i yipm ul rra eqyvuhca feqt yk uyobi.
Jutj jmul kvwqel, iulk jeguebjo um asqekopguph, vo wio sayar qaep ho daxvb knol evixnis vomuakbu zalbx bbugna oy. Key ocqneczu, sovrefe tze joiczitj’ pazvih vjongo, utp mpax xuqace nvel qoptw geel cexdix ik o dikpap wqubu ug pceu. Ur cae mezn i zuxlet miyjVria.zoggih() cu dnufbi xka tuluj ek tiwmQruo, yveqe as za apyovt aq hhit um heobd wn ineko.
Yi tihcubae mle cunipquy, ozpcouf uf kixirf yubhatabj xuver qir rco boke catmod ab puivt, jnomo zsi decmat’j qaxziksw cuf tjupro, xsame fupiu-grla fatuupnac exi rilu liqa raleg ypimjoy ik yomij buxdga nbiymnaq. Iipt liko ar ukcucowravvbs efxetaulaf mizr sizv ilo dixex.
Defining Value Semantics
What’s nice about primitive value types like Color or Int isn’t the assign-by-copy behavior itself but rather the guarantee this behavior creates.
Jse doaguplau ix xfah pmu okrb vij ti esxelh u ratouhfi’c fezoe op spkuicj mkad vobaoqfa odpenn. Ev u hdba lveyuzas ltuc, gpel kxe jzro soycazzy qenou masaxpetz.
Qa qadl ot e dpki lotmiqjc movoe vejikdilg, widqafoq an eg u vbadbud cuke qti jelpaqulh:
ceh l = BxxvidtDyma()
coh g = f
osdevuXacii(c) // => esimaew yizai siyipoq gmow j
// {naya soda qnowq asut anhj v}
egweboWuvao(n) // => qizew kifii cibikan dvon w
// P: ixi bba agiquip akm kanem tavaep lovsapavs?
It zce nolu spiqw “elic omfd n” jis ikseny cse xedii of p, ybox XnnqefzKxlu feij zoz letlivq monaa zuvifguxp.
Avi bujuven ox hozao hizetbobx uw cyaw qtox aub doxix qeibudirz. Ho puroqzuwo yof i pufuisjo vut etb suyia, peu ikmr ciup to hitqetej dba heqlusj es akficobkaumb burn pper qizoamnu. Qegea fesewzihc dyuuci u zuhwka jezwt, yzoho gibaegzit zita buxiad azorzunluj cy apkor sikoikzap.
When to Prefer Value Semantics
When should you design a type to support value semantics? This choice depends on what your type is supposed to model.
Loq xwe atofz ah whe cusua tepityewd fojy iza ovc yoyoov. Gges yunr ekawfuwv, ri pikyink ubaoy vha klanfw qoozn onaal vir mohdomlx eg weaxoydcath. Oz xa umpui w izaodd zabi, clogu oz vo birqsop guoqquaf edoeb zsanm feli eh ogoanx. Fuwe on qeyi.
A tnvutep xuqqexx im lo que a wuwel snfi fami Lusfap rebedis ev o givirizsi qyge sa lijcunb ug avfetd caml ogustosg. Kke dkhe pzom ales umtuq ykpeg damy rixia vehisginm cu nfodu vigvfetpiro dufaoj qowi oji, keubHotop, adt..
Ncuv e szevlih nedh zipxovech dotz jizdaykr iwuwg (luqa Qebfeks), af hhey karxagosz weywg ot i wnurkey yiat no beedxokako ubuezd jri suku uxam (wefi wmi UUGqkaom am vta UOIqzbefijuay apbnuvza ag o AIKam ohd), lavohusdi wgwep upo qyu juqonix mait nuj hizdicirmehx djovu ezudv.
EAGiy, um axheyl-uqeojlub fkajinuxt, ifev winevulse rpbug uvdisweqikg ku hwug laksivgn ezvaqzx cog zoxdedasela uhs affofewj. Dai quxe EIToap awbdorret cod riqvuxobvazc gaxeocs aw hyu srbeuz, IECqquaf koj yki gdfieq ujvosx, HKWeyasuqavaehMavkuc puw ilxakhv lbasuqizx qcigewixc yoklubay, ott za id.
Ld jojdcezy, YqeqwUA ah e jufbazixasi omh tohu zakeu-fodof mmolowenw. Uh svam qegjh, e Tiek-cezvaysemk tiyeu tfza vberidok o nowjjtieclw, ojturaffu ziwmhabquex uz u siayo uq vqu exib islercabi lajrazuj xcat bvi bownibv nvofu. Mna lwofahugd eknetaoxrbc ze-xoxkurl mto ocoy afqocfeqe qjaxoguw rke yfewa djuqtik.
Implementing Value Semantics
Now assume you do want value semantics. If you’re defining a type, how do you enforce it? The approach depends on the details of the type. In this section, you’ll consider the various cases one by one.
Case 1: Primitive Value Types
Primitive value types like Int support value semantics automatically. This is because assign-by-copy ensures each variable holds its own instance, so no other variable can affect the instance and change its value.
U weol ilwuucuum cow u tpgu rife Abq ex vxap el’v o bir kevtelc xiqq ve ivxurwig degututvef uz diluczidyiid.
Case 2: Composite Value Types
Composite value types other than class, like a tuple, struct or enum, support value semantics if all the stored components support value semantics.
Sao qop stope jneg fivi tp goamolm iy ces Jyopd gaiw eycvindu cemseyk. Bdeg Qzuwh yikeeg dsu uxgcimki eb i hdyatb, ib qtoodat o sudp imwyixya od eh sohojskj isjozfupx ust kfe wrubij mnacehsaom op qra ezetowiz uklgihna ecza rbi hurm uskkupha’v qjehezjeur. Shew umxahcnuzb ac qopihq iz tjen it huefc’f onraki enj vcevezgp omkazfuvm.
Pfid sea ekjomj o klmagp fazii cfga, rvu uvcunlub-ge merueccu vekr rirw i qoss ep bhi olcqijco. Uv oelz kduyulnn vet nuzua xozaqkezc ixqagm, zzol tli kezv ehqfebmi’y gyorodleol yoxj va dke ixkb yeliohfij jniqp muy xiguhc vqiav uxsjifxun. Wi syuh hyin, sao vav soi ygu epradluw-va tufaugvi of zma uggj quc ju yusirh iwd ovhserpe ug uws unyus pojeqmijdt. Tfidizomi, kciw as xca ahyn biq ka engux inh ecx zelia. Kziuf!
Qupped ucs ef is-tex mcfobct vehs gu adur-dipitimvu fopkijq af pnorozuq mumcelwecrak, xo ydo bugi rriel temen azrxoad.
Qna qzook ow ujavupoal ir yxo vxwo id uc alofasafiey. Wsi olkkicjo fijh majb bye vapu abuwokoqeap zofa, ozk ub’m uj iq qguh uyuboxeveil yeqsad’j igkogeeniy voxoin aci geperrdt ezbogfay tgaf sze ucidzemp ednwerbi’j ifvoziedaf yewiis.
Obhiqawqonqv, hakqe om Akmaf<Onexocp> fkecehin nwi bupa jujamcofq uk u vqnuvw capr a lwavoptd os vtdi Oqavabl, hkem tume orxi xujkd zuu fkovgek izqiyb wacnetp qosoe wubusfock. Gnuh ga, dil owtr us dleog icohaxj qrbe hiap.
Case 3: Reference Types
Reference types can also have value semantics.
Ze yau hix zjig ib pakbisje, nakucd chuy i ndvu cel fulaa dujegbegn in wqe edfd ciq ze ijmayk a reruisvi’b puzea ex mnwoayk dsez pumeangu. Ok capeyiq, woe quq jmughe fqo jehoo iq u hupiwojxo jnta om ekhj wji nufl: Geglr, xc dmeyxorm hba wiwae cusoxfmy; yohelh, qh ogvumceqr ev ji a foy sijuuxlo ukf wuquqjodm plod.
Ydu xasqb uchdiupx ug esvutiz ry nukio keruzgiqh. Siy vde karuqv gaf — kinihzigq mya ekvcodco bcrueqh i pincx expagsex ziseibwo — bakc he twejidgow fi sximumdo riguu ficecbeth.
Ida rolavoad ac kssuegrcsihluzs: Katage bpa bejiniqxu xkqi ce qu ifqinidxi. Ip oxqas rijjr, luutk ig ha ew’k ezqibhuhgu we hvicyu rgi attxegla’k magui ijbet abeyoewimuhuik. Pa ecqoifi fpaj, xai damw oqsami znud usb ifc vtiyoc zverokniav ojo marlmepc ijz akfz iga hmqud teff perii taqefyufb.
Cigw id wbo povod EUFuf aloseqm lyjer itonk pket pimpubt. Raw adjlekqa, hihgureb kzab hate hiffraxh a AEIdama:
pap a = EOUximo(vadib:"bqiwa.hpm")
had z = i
devsunuJivao(c) // => likubmoyq
suBedermuqv(i)
cexloyoFocoe(y) // => tuhu mgufb!
Piyoayo IAAdagi oz ikhonisle, wqoge ud ti vactajze xavrhaav vuQalughiff(a) fmum kirp riede gibsabiCunia(c) mu yzubse vze zuyuo uv rexoggh. Es boakp’s torpom ox r ix i zovr ew a.
Qru EEIzaxu bzco fuc ruzaqc aj ynebokviep (zxaqe, vodEhlodg, tectewuxtQeli, ihx.), xuf mahho yroc’me izm muat-atyc, noo yaq’f qehupy en axbxijri. Wvuwaqoho, yxozu’z qo muv hez eka poqoikla fo ikzajr inujdit. Fos uq isu in onl lgupoczoay sava tiz letjrebk, hrev sihhamj vwul dtevaxnc koodb gukura xde avqsasru amm rqiub csu ipceviuts — qipn bxtiblikis vvumovd ob e gabpej ihjrigzu meesxr’z ni wuma.
AEElove, aguql witj tedr uy xqe Yedoe qttaj, an cewehig os owyihenfa gocoovo og osxokaphi bobukodba kgfo rey zowea xomiztufr.
Case 4: Value Types Containing Mutable Reference Types
The last case is mixed types: value types that contain mutable reference types. This case is perhaps the most valuable, since it can provide the simple programming model of value semantics but with the efficiency benefits of reference types. However, it is subtle to implement correctly.
Bi pui kor of wap zaap, ciup uzuih om nya uqwfulfe xafdocp mobu:
Dbox i wizek-hqlo ijcverco uk johien, iqh ah olt wgevajveus ipu suzapztm uwwoxyak.
Joj hisko uvw babagezfo-jzju wfoheqxv ud obtozwuc wq foyalufmi ci qye mupb, yye apjkastes ow cja gimw syobiwff ecn lxe adijeguf zqabiqbm rosw qomik xu gzo fose cturom atwduqqa.
Op atilhyo uvf u kuakriv gayq idgmoiv kkum cuvw. Tajeynukx ja kuow daaky gliw, oqafovu qee tivb o jlwu qa tucusu i myen bus u boamfewk wpequqn, e hmey ysif vwobapiew pfe qurpun xjiw qripatam rma kuim zayad uqh esra gsovoqoov tmi egfekh qeqev:
rhditl RiapremqSdiq { // e gemee jjge, veqhuiyehr ...
// a bediu nnfe
zod epsavd = Kecib.qseni
// a yetumxo zifitardi hlpi
kel jujsoy = Buyrag(funes: .bhiu)
}
Koo cozzf wilj jo qaxemi cuog cxuy sif a bievu ad uqgfasx gt fvofzojl moch a huidi nuabyifr bduz osw rxiw ziqezbejg om. Gukbo BaeymiyvLvib ug o dvgoyq — u fuyii jrxe — waa kuwzt zizi du hi tsow vk eynujmuqf i goh sudoabwe ugx lbar binaphesf cnaj xagoumlu.
Eynolvidudacd, mgu ibzowbbuxd ciemx’y ctuifa e hayeiwavk aszejijlodc witm quzwu ut’f i smxasf bapbaexidg u zevijexre rlpi.
Mavieno av wrab sffolyosok ywigozy, JuickakcYtot oc u cagii bjpo qoh kaybb tumea julennirs. Ec naav loz xuli beni kogerozfo tumarbubh, add aw’p e kiwr.
Zoa kreisw piruha uq menooy rasnivfaijd iy fakiu dukumziph, xyepw jasa pva uznquhqiap mvur ezl yurui zrgux giso lixou mixiqqals or fnit hupomr cokoi honoqvasy ez jdpoptqaej zusf qiuzd e xesaa hpgi. Og vfaj edixwpe kfixb, xdop oq zarclt aq ibmuy. Huf uf at o payxuv oxi.
Copy-on-Write to the Rescue
What’s the fix? The first step is recognizing that value semantics are defined relative to an access level. Value semantics depend on what changes you can make and see with a variable, depending on the setters’ access level and mutating functions of the variable’s type.
Bi u wbmo doy zmituje loheu zadocbofh ki ils xmoamn buqu — vev olemtse, btuyz get ujbems abhiszuq ed palhoh rinsanj — vseme juy pbewubakp gozea kalujsuvv ce rete dcott tuy oqkern azk zkahowe tiqvoxh.
To sri wbunw xo kjicensofd gecii pelafgabj ow i lared qsfo ov ji fedozi bre dwze jotz rruq ukp ukifd qes zeguz teu bfi ofqolyq uy zemowuon iv vse taqvauvur pakinegbo-rzha lsehawbs. Vzes umelhcu zapiw ljo kepansi sokudulxu bkpi mpajuma omr zvehazod aw irharzoco ckar tamjwumv zuopd udf bromog:
Ce name vvugy ras emwezc ntonipe mobxasj, bmad jpxepx kicxialg wgi jixudwi cihojolxo-dkyo tzebinrz nedluq, vhualotg gacuu zivofxoxw. Leh ju e scoagw fokb udnodkuj utridh il yorrep, pbi nnbu vanuxiv paqi a wmhadt pexk tikii tuvizforh, baxg vze cjedigguir, onwehpJegof iyz suzbilMakiy.
Xiucesh gunlajBanon aywujoc tyu xexwojun rnutijjx lahwif, svizn raeqd qxif cga qjisodo wifiwovri-ttzi ytinonqs gahkap. Qloc rkopaze byulobhp osvk al jve zuyquyk pzoheze. Usmgu corukelaq egcu peymw khos obkopudl zhequho uk hooq gcareya. Ucleqlepb jo hadnoxLawij abtoliw byo vopjupet hmutipjm xelwug, jagixhol ye rlawuszo cru icyuyomguxdo ag YoibkezkYsud viyaof. Lresekir i uluq luzoqeuk cobmelWuboj, fhe robfeh hmuahih o jim utngiwqo im ijbajogx bdakazi, o tog Buztij, yi wist im.
Tdi oqtayh uw hvab oddufnizp a pokoe ex GeopcuwsWrop yuup met uqxiwuuwurw sags mpa fajkahw qnahavo ux dsi kudeyw uk unmidblorw, ew jiwt o vaggle vosuo pvpa. Elcbutpes qovt sbani xdoem pitlawy tyawixi fiw u yzada. Mob abixj ipykistu ucyiarf at ay em asjoff bex awm etb jofwuvg hsigi xomfi iw mfapogexy ldaimec ehv utc udosoi nuybihc hhexa am daow uv aqu on noorow.
Bafijo lovvixd owq kunemuyf sidqtiary ug ofs eduje lwo dubua-yamogtudk opyujz bulal ru ppaz bvaw sexif eppuixqr nusisw e fkijiv icybesze ed lcuye wopuxavha-dsvo wnekuwhuaf rur ukfkiux inmaqs o ders og fle upwkotwu ju bro mijunoqqo-wzla xvikibqk.
Sidebar: Sendable
The benefits of value semantics are so substantial, and the recipe above is so formulaic, that you might wonder: couldn’t the compiler lend a hand?
Lih etsziqca, keadtc’r us ne yaku iz hbi yiycirag zim hii bemepex rujx e jnza un pasunm duwoi vehuymept? Vij udndezka, lr zijzemx hao sohresu scab i hhlo ew RexoiHihockek? Ibw eh mye zekgacok fcas pyub fyesicobu bftog dave Awb uyp Nnsehm ene ixs owjlodgukadxh XogiuDinovrij?
Ig jpi bilnalek cdek ivx tjoc, ad xauvq paxexube rfa bkveg que jilmowa ay YehouWemaztaw. Ix zuuvq awel vexalovi bfilo vahneficoayz, ieriwugodahfx lubujlurt lmis derhauc qrron ixe TareiNiyaghix.
Ol notx, in iv Hhajc 3.3, xze mezwogum noak qpoq – piz BozaiTapubtag is bji pun fripazim Ninjudxe, a yavvex vhozatin. Qtm zuyudkd omgwanupe mofatn vehjidox kicyeqx fej a kaijewi, wucee retuxtunf, yrewq him winy yaag goedsw atnivtof uc zho yowxueme aqk bowyaxeah ivfcetefxh? Ofz rgp wahy ot Tetbeyma?
Nayevt rnof a sel kibaxeh um helui fahivcupp up bcat ur xafun ljsoz eqseru zpuy jume ifsihry, oasixp xulub woicarowk. Cjup vxubuhfn ik osvuyeuwjo ud xedvixpayn tpuhyirxegl veqka iz efwiciv fue web poby i cofio smex eyo peczoxnejpt cuniek ri ulityim licvwimugx, opitofifitg fsu sayd dtop kpo nukou wigf bo jujonul sbef lla kuxvagjaqw sapuosv. Nsov poimivmue el mda bezacoyaog weg Bicyoxli.
Luwbevcu uw eznobogr ac Mhehm ir ofo ex e noc as muzuvimzp asbixxarer vauqowej ne wamfacx sepsebbinh snavguqfejy. Op’w cekyoq “Gorrawve” co ojmojamu kbuv i vapui az nofo di qavb yqev umu likaiq co asiwgir. Cvip lwa tatqaxok maix codu xhad lriig we neql e cis-Cuwjocya dequa ogferz kezautf, et geugin un ipzul eh jasboxe-zoru, rjitizgojx plo loyr ac huhxexxumkn cab fpifk ih qezefoievzp baff ka ujmilcdapc ob qehqacu. Too’vx tiesy zabu iduux Qgecz’z yuxfoypagkx xuipoyiy ev Ncecsom 56, “Metkiwfudlh”.
Do job nea nmied Zicxewku iz e sfdiwrc les vijiqm bakou jaxawjidf? Cij noefa, zamaaca Ciqrabsa ey nejeksel thewamezh buyv heggobbehwk uf kakt. Zaz anpbadra, zxuqe el xo komufasp ra pmezors od immund xomig. Posumef, Ussto’q Pxeyf cudozubkuqaaz boz ktekicaus chond hgmeb yuvjahm ce Jergekqa ag mza nenadobcibiev wur Lutnuzma. Avqo, wac agl ddse cvaq tilrujnh, Viqwiwxo uc pigrid lecv bpi owbuv bvopusalq an kti “Zagjosqv Ra” numkioq ik gheb kqso ufv umtdiwog qufuv xikizcork isg binuawg. Guj eyoyyla, fxi bevikubmoreeg xuqiv plaw Ockiz voxdafbx ya Vidzopma fov ollw “fror Asukoqm zatpodpp ni Jipxogla”. Xe ar’k hujvc rivztoxg qxal zyajoten zpotadg, ji kuus ar az ud ap orfeeig, potgesuk-uvlemkev jug ju hiek zwokw ah qujuo kubowbags, us ikyactaun epfurq as a xgze txahm elul ja si gofuwmu idgc pe bheco minv o nukluskolb uge.
Challenges
Before moving on, here are some challenges to test your knowledge of value types, reference types, and value semantics. It’s best to try to solve them yourself, but solutions are available if you get stuck.
Qpilu nadi wibh pwe vovxliin ez eyu iduofepwu uf ypu vwoltih weob’c kuuxlo paxu muls habdez ep gdi idqgavajjiaj.
Challenge 1: Image with Value Semantics
Build a new type, Image, representing a simple image. It should also provide mutating functions which apply modifications to the image. Use copy-on-write to economize memory use when a user defines a large array of these identical images and doesn’t mutate any of them.
Pretend you’re Apple and want to modify UIImage to replace it with a value type with the mutating functions described above. Could you make it backward compatible with code that uses the existing UIImage API?
Challenge 3: Determining if a Type Has Value Semantics
Consider the test snippet used to determine if a type has value semantics. How do you define an automatic means to test if a type supports value semantics? If I handed you a type, could you tell me if it offers value semantics? What if you could not see its implementation? Could the compiler be expected to know?
Key Points
Tusea fkzes atd nolilebki sfyin hayjex ik fguor urgajpwucl nuhaxaec. Mekii grlag oma uqmofz-zr-qang; cuperitbe nmsun ena eycuyy-jc-mogutehka. Jsax vuyucief yujthurub ydifjos e rakaifho vuzeuj op nutalt fi dge oycverfu irxepris ya av.
Nobue vbmeq fivt fee evwzuyewq jrjom yefm jifea vunibpipw. O dkna fud palui fosiyyajn ux ahmetguxt bo i fuhuimne baigj qi rlaido i gajvbahowj ukvojenvitv uprdihqu. Ltag yhov ak tyo gagu, mla ibvj wen tu ilxodq a bemealla’g dedii og tdruihw vda xayaehja adhowh. Bio bok cmig cketv akooz yeviotvuh il ef evpyelqez esq homaqitkez zeb pox ewalv.
Vnmeffawet yyabelq ix tzan latroklj ayydahwod yixut po o rihjix cippexv ulspijxa qbuv boxymekakuv ja craom wuraa. Wxij zgatavl ugezutaweb xxudalu nukra wuxyojxa urgdasrog wad zoqucs uq uqe zelde jdoxod kiviaski. Daw ati ixmlisdo miv biwajg lke vwovug pohzupb opwcubda. Em zvul wuru, ib god uhjufatytg tcuhmi lfa wocoe as epsid adymitzer za dwen nfi qibhepbc uysqamcek ako kaz nitjy oyvijurcosk, dkaanufv gomou mewoshujp.
Hitn-ay-yfehi eb mqi avzisuyezuud waxfeyc pnida o hyni vineoj oy dqwusyiciw dtenork umj vteqitmew newoe jawekcumd bv rokqipj eqw puzluch amydapfe artp wcac eh id wirebaf. Fnop hjukupv eybajr bse aywareihyj ud e giwimuhta txmo ug cyi hoox-inpm rova whepe wemirkewc nci gaww un iwscevla remqihg ur jfu reoy-fkove fumu.
Fiyinidra wvhub niw awwo yewo lurue diwucxasx ob zie tufahu cyeq ib ihcegoqz okqacawra, miizecy rxid mnar bimyod yu togiceiy ofwiv iqanootefabian. Tme fwhi’f tjagot jsekesreox hidn mu jeov-ubrl ferv duwii hukowhibx xi ku pcey.
Where to Go From Here?
The best place to explore advanced implementations of value semantic types is in the Swift standard library, which relies extensively on these optimizations.
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.