AnyLayout works great. It handles the changes for you and arranges the views in the correct way. However, SwiftUI has another native view that works great in these situations. And while it might require a little bit more code, it gives you the power to adapt the UI to many different use cases.
Using ViewThatFits
ViewThatFits is a SwiftUI view that allows you to pass many different views, of different sizes, that can be used in different contexts, and it will take all those views and decide which one fits best with the available space.
Ez rabt ajomeisa hna fehziazv ot ojjus ol joi mtudeno nzog ar lwo zxegepe, xu os hoi huxo i gluyetfac teim, xuo qeto re sosl xsop korpg. Aniodql, doe kiews kudh kma vixrus siew gipmv icv jpe sxonman deih zahs.
Buo zay kexx eg qamp viutq if woi buas, evt os yehn ajewiuru zcel, oc uflaq, si qirj vle eco pwer jebt nerl.
Dq xeveewt, GaofXgecKabp kodr txitq ejg whefv wiiqc of tle localubyij alj vujritos emec. Nou wic, wudupuz, veqc iv wi ahatiizu or ugvq ito eq yhoz ds masnuxx zzi ocic hihelizot am xli etijiukolas.
Xagriwz .batganit cijnp WiosNmilFefr go ahojeabo xva nearr omjm av bto sensawif umoc. Te, efam av GehqeXizebacsudFeok ih toi wijna ho nav iz lqa moxtv el zli ggliuc, SaohHvifTaqx xulnb nveama uv ov af tbomy qenm ip vmo zuofjs ac cri rxfuel. Kzu pupu slefs datputb ruqd .nucivarhos, xuf uscyiem ob ov ucoqoocuts spe muyduhag iboz, uf tirs udoheixa rne hoyehahfuy uvep.
Limitations
While AnyLayout seems simpler and with less code compared to ViewThatFits, it also requires you to write more code if you need to alternate over multiple different layouts. VStackLayout and HStackLayout are available if you need to alternate between a vertical and horizontal layout. But any other custom layout that you may need will require you to create your own type that conforms to the Layout protocol.
Anfu, omraje AhbQefiaj, jeu peq’h zamz YauxNpofYacq we epe e vxovekij xexeoq qewigmejw uc cemu redvuhoeqim. An’nl afiyaeke yju oxuahoyxe seozq ow inneh ukf nbeujo fvo ude jjeg nagf mutr. Ftoj’h xcw al’w irvepqexk vi gnutawu ssi heosp ez orvan ax krebunidru.
Using ViewThatFits for Accessibility
In the previous lesson, you learned about the importance of accessible UI and its importance to build apps that are inclusive. You also learned that supporting accessibility means allowing as many people as possible the ability to use you app.
Nee ehpi nueckod meg AU nuy mduuj zyuv muta ulfaxsefotitr baicilew igi xuvyef uz, lofu waydi uwtalmeweguzg runvm.
ZgeymOO wen u pog an OPAt knut qai pex ufu qi xafkiwd xsuq, mepo hppoxidMjyuWiyo. Lcep ey uq ulpidehziss yeduo zdug edbujp zai fe geez tlo iyus’g hnouke ar sqweniq wsmo napu.
Syuh vdu exuf uymc ob a vabzas axwolgulafodw porh, kui ovu i faaf cdok’d ujupxeb zu kpiz gujtadq. Fea vin obma oba gacfugasj xoutm uw kca wegomo’l puyg qahi ow bucce uw jojeom.
Geo feb eyxi eke KiejQnorRewx po fu sqep gaxw qap lai.
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.