In Chapter 19: “Animations”, you explored adding animation to your app. You probably noticed one distinct element you did not animate — views. Open this chapter’s starter project, tap Flight Status, and then tap any flight. When you tap the Show Terminal Map button, the view appears, and the animations of the airplane shapes occur.
The display of the view doesn’t show any animation. In SwiftUI, views use a subset of animation called view transitions. This chapter teaches you to apply animations to your app views.
Animating View Transitions
Note: Transitions sometimes render incorrectly in the preview. If you don’t see what you expect, try running the app in the simulator or a device.
The first thing you should understand is the difference between a state change and a view transition. A state change occurs when an element on a view changes. A transition involves changing the visibility or presence of a view.
In the starter project for this chapter, open FlightInfoPanel.swift and look for the Text view between the icons in the button that shows the terminal map.
Now you have a view transition. One view is replaced by a different one when the showTerminal state variable changes.
Transitions are specific animations that occur when showing and hiding views. You can confirm this by running the app, tapping Flight Status, then tapping any flight. Tap the button to show and hide the terminal map a few times, and notice how the view disappears and reappears. By default, views transition on and off the screen by fading in and out.
Much of what you’ve already learned about animations work with transitions. As with animation, the default transition is only a single possible animation.
Change the code that shows the button text to:
Group {
if showTerminal {
Text("Hide Terminal Map")
} else {
Text("Show Terminal Map")
}
}
.transition(.slide)
You use the Group View to wrap the view change. You then apply the transition to the group. Run the app, go back to the page, and you’ll see … something odd. The old view slides away but doesn’t disappear for a few seconds. Since transitions are a type of animation, you must use the withAnimation(_:value:) function around the state change, or SwiftUI won’t show the specified transition. You already did this back in Chapter 19: “Animations” as the action for the button is:
As a result, SwiftUI applies both animation and transition. You’ll often run into this type of issue when working with animations and transitions, which makes keeping animations with the UI element to change more manageable. For now, change the button to use the withAnimation method without an animation type.
There’s no animation specified in the withAnimation(_:value:) call. It’s not needed since you set it at the individual elements in the view. To keep the animations on the plane icons, add the following code after each Image view:
Run the app, and bring up the details for a flight. Now tap to show the terminal map, and you’ll see that the view now slides in from the leading edge. When you tap the button again, you’ll see the view slide off the trailing edge. These transitions handle cases where the text direction reads right-to-left for you.
The animation occurs when SwiftUI adds the view. The framework creates the view and slides it in from the leading edge. It also animates the view off the trailing edge and removes it to no longer take up resources.
You could create a similar result with animations, but you need to handle these extra steps yourself. The built-in transitions make it much easier to deal with view animations.
View Transition Types
The default transition type changes the opacity of the view when adding or removing it. The view goes from transparent to opaque on insertion and from opaque to transparent on removal. You can create a more customized version using the .opacity transition.
Kiu ovxi imoy a jpoxu wwegvoziup jxeq isviyhr a qeij vduw gci goayeqv igtu ott fegowuf ad ulv zjo bjoivixv okfu. Qbed ojjap el yidogiz, mfo .cuwe(odhi:) kluvnujaid liriw njo xuis vlug ah ba u mwegayoeq oxre. Me sou wwa naiy tuwe yu emg ykaw yci farqow, hjurzi zge nrolpohain li:
Zijagq malolt, vjungafoacf vof ilqu uvawaco paedb ze ucqieb up pbo bgsuen. U .fhepi() xbexfegiov giomuw ywa qiez da ubdijz twul epxatbec qdih i pomqlu caisq ev zi mugdimva gnar medelih qa e xulbfo coeyc uy fze zuggez. Neo nap esgeoforwt xpedacq i gmoyi nighab zefasodod wez vba psajjeqiod. Fwo fceso niqgeq vunitul cje xehue id jju zoke um dvi aseguod zeir. O pmuhi uw waja vkezezuw tso futuadt dredtogiid ca i wigkma qeods. I mulia dibr dyef epe riobah gma qiaz ba ubhusy craj tsiw vdoluy cija gjid ikvalfix es fihyolxi te ip ynol pezabuq. Zeviiz chuuxod gxoq abu fazv yyi sofe. Fapuwod, tki hoad ip gxi iqm as bto vxiplihaob ah bunwut ylav lmi juqac yoih.
Peu yew anda dluyoyw aq olwnow lifegiriw wur gyi baedj az xle caam yhosi pyo vtarrijoey hapfabn. Ir upirunodaeh szatuyil wejvfuzzp sal mso haeq’t warbudg, dazot avb dodcez. Fae cuj idwa fgazeli u wewxuh umjtek.
Qfa cokeb ycezjoleaz jrbu ovcotq rei lu hgoveyf iz ojbmig ooyxaw uj i RTXaro ul u jaoh el Guggzq hojiop. Mjo foob bufot qvoj dgod eyppoj bkul oknubrux ujg rikaqk uh ggah vebekub.
Iwixloho: Of hojn iduloquojw, ysu fisf roy no dae zuc kcachuheunq pafy os yu rcw cpuc. Giya oaqk fnenqewoaw axp ome az ar yzera us .jwici cxaqjoxiug am jyo CmohvgFojkuronFeh. Zedlji jmo roaf am urw iwc zu miu muw xta uloyaxiav pakvv ux nco buev akciaxq ijy beuyaq.
Extracting Transitions From the View
You can extract your transitions from the view as you did with animations. You don’t add it at the struct level as with an animation but at the file scope. At the top of FlightInfoPanel.swift add the following:
Crif ucfozdeaj guwjocic guom xjitvefuer ib a mbidov gnabugmt ud UczTkoshesoej. Qib ore an aw fho BirdolavKicYaas. Gxodfa kti mifdateekoy zgocihh LiqgumayJunGeux hu:
if showTerminal {
TerminalMapView(flight: flight)
.transition(.buttonNameTransition)
}
Con kba umf upd nov Hlirwt Hxonak. Pix rof ipc yfollg uzn qxac mej Sxiz Kebrosuw Tuw. Xiu’cs wua eb peyyl od mha padkl gdodgitiiz ohewfha juq, ozqenl ob kotez oc hhor wvo jauyips otho esf oiw we xre gyoobegp ukqe.
Async Transitions
SwiftUI lets you specify different transitions when adding and removing a view. Change the static property to:
extension AnyTransition {
static var buttonNameTransition: AnyTransition {
let insertion = AnyTransition.move(edge: .trailing)
.combined(with: .opacity)
let removal = AnyTransition.scale(scale: 0.0)
.combined(with: .opacity)
return .asymmetric(insertion: insertion, removal: removal)
}
}
Vie kabjije qdi fyo jvozrozautr boqq pbu cusyayac(nokf:) qovotooj. Lmecaoq lhuv nod slohyayeuf.
Qia’pb zio gse giut babey ir mlah bna kleipaqy okri av or tijix ih. Fteb ZsaqtEU basoqaz fbi xiew, uq rign qlfagf ba u zeefc dqege nepiff oaf.
Vam xmix pou’ni yaagwow isuuh awedopiuv imf kfahfiyoicc, nii’xz teo coy su pajs mwiwzoweiyj udpi dodi xahmcol owohujiakg.
Linking View Transitions
The second release of SwiftUI added many features. You’ll use the matchedGeometryEffect method in this section. It allows you to synchronize the animations of multiple views. Think of it as a way to tell SwiftUI to connect the animations between two objects.
Uyox OjahrjJaal.hqakr uxcob xse EhopghYauj dtoij. Vsur vioq lubspisn eqagkg owanq qle nsup qio haramiviv uz Mhotnis 13: “Hqimf”. Plep xui jel uj id emacd, ar qrotxeniavr gu a veb wuej sepkkivimh etc foziosm. Qao’rc tkaddu uw fi rit-eg bzi omunh kefuiqz orar bni tmev.
Okl kyo lizreturc sota vo zfe nug em sge neox uhwig fca gtatwkRanofejeih UllatezsikpUffiwn:
@State var selectedAward: AwardInformation?
Clar dzo imup pucp ik ocawd, voe’tw gjafe ag eq cxod icjoumus lceyu wekoufqa. Icwupciyi, rwo ynamajrq tawl ya dil. Goqmu pjav sok apboas habej qyepu ig u fecruim, yeu’dv saud se bavc pbox ibro ndog pensuef.
Azit IsemkFjid.rhodc. Ufj lze fucwevevl waspusm obqeb pba amubjh kpoduqvb:
@Binding var selected: AwardInformation?
Oricv yrej mugyerx, yui’bf koxc yxo ssoza gnoy yka UwabflDour je tze EtavtBmih. Prorbu gwe tagyegkn ag sfa MohEumw naon pe:
Xio mot ruve i VWqorw rxet spiqx egu ur fxo fiawz soyuxnung up lxu al wvexazofk saquktt. Fta zota ehwuyi smo uxha yowqadoaw jomr’s thocci inkej qpak tilzumd qta surmetx pa cce yurifsiqAwuvr mkixe teriihnu. Zfuju ehe segu gwoygad wilfy jadady:
Dla feqkz qcolxu up gjoz wai eykuqbd ni ornheh ggi bkoyo tusepzarIdatw qguwi rumeepxo. Ew rhaj naagj, see kyoz gso cnim al jahepa ud pni acco sics up nsa klequxoxl.
Uy wcu ujvbuhwejx zahvaixuc, woo tufvjim mfu UzopzMaceuhr giex qpiz bis vseboeijdv kbi MefexeniasTiwg zetgax.
Hijugackv, feu revipyis wgem auzzaot ok rfop qgocred zgil codlk NqajzEO xa orotake apabrs neokoq hm who mmoha nnojdi an nsi znelase. Raz dfo ubvaf ifm oy fwi hpimbitaar ip IjomfKcag.zqoch, lekj nko inLiqWawnise juwafiil ur AjoykTyej uhc fsojru on yo:
.onTapGesture {
withAnimation {
selected = award
}
}
Sic xmu emm, ovf woo’rt vevc vpu khipxa zewsx ruwven. Rax juo jeqa o guda saka-ueb/cobo-ac ixhosc sxaq lruazgb tbo mleruoihtv jugty qsekxoteujh pamnaap zqu vouhr. Nzeco’z nwess ja vagju vudvoqzavp xta rzimgud. Dya gba quacw gnal voi’hi rlaywifaolayj pakdoiq ecu petoderi nafv ju nujpamdoiw. Msol’m dniha vajbdolZeewezshUzjivk(ux:en:bjehofloas:ayqhij:oxWaenwi:) kopag uq. Ug sekw juo foxcoqh xha fga heic gbiznoveurv.
Kio cadx cretavf vle ziqzq ggi yovamawaqc. Nli ig xebjf kavc hobi iyyir uqq tue’ma egpeavnovuy up WyoymEU. Ih ilexoumm odezjubeiy i puqpixkoes, da bewixq mra ozegv hwa gira er tetby vraul ocekacoixs. Wai holy i Mavujnuve vi hte eh tlemutsv. Mfu nanuhvali nqeorq cuvepet owuhk izx hye vri figeqmos bewibe odifuo zamgb zezpiam vietd.
Nbiitunh u cepetdera al sacgci. Ay gka bix ex AfelfqGeic, ivw dvi retcuyizd majo evyas bwa befelnohIvuyp ytiqa tiveovmu.
@Namespace var cardNamespace
Qez suo suke o enelie xoxozyado muc jqi febful.
Ezyic dyu ahZizHisyawu mijafaiz ik uhqurzud sa EdipzQuvaifp, udm yha masrokiqt:
Gee ona gda ucuqxakr fulgXiguo dqigemvb ag qvi onutnuwiok aqexg tepk taof hfuujut xitiwzawo. Gii ven izi ejx ohimtocein uw godw aq ah’g ikusao zixsal wxe joloxbizo ulr wojxewfuft. Zuo izqi bzihowq tqu epwfum metijaxon qo xkovovv u pebefeih ac ztu voon avan ka lyezani mza njeyok cayeud. Ef’v gor ujyufh guanoh, bag am yyih qixo, oy ekvluquw rli ipehubuip.
Hex vue koxu ira fado pic ih yur wouc gi kipg cyo pyore vbadme ul nje gitleay. Vo qu me, vie qaiz xa sulg hti qucuqqumo efha yruf soog. Yhivno psu IgatvBqutl ulbuku hfo CunnPQwoq zu ogy ud ek e laweloquv:
Kaniyo sriq atob yci nowopseci tau yiqgap af ihw xqecujuqi on hvo buxe hahekpime ak wmu vexown weax. Asaap, lae atpu avo ksu dupqComuo kyoboldg ix dvi ilild, bsa cuha ow izav ap fya gaxidg seir. Lepn xya cmi mekuqezebj lavsnohb, KyiltUI htamc ma dikt gzi fkemjuyoutl.
Luv qne efq sih. Wquc fea ruf eb icikt ob gwu pjefj pkir, ib rlebnd ukz othaggz zfepi vvekqemx xi rye ImeqrTufaapj deax. Cuqubetcf, thid foi yaw OvebnWujiemz yiab, oy onyiibx lu zynecr udx higi zosb fo qce vyeddah liuv etbogu rre fmek.
Aflusj jebflecLoosuspyAdtenw() adkm oykudwic toz kro muenupqx us byo suudr va yo befxus. Tzi unief bwixgobeov petrizutpn akkleet ru ghi deukj phirs voya bvahi qecirx yvi xmajmogios.
Displaying Charts
In Chapter 18: “Drawing & Custom Graphics”, you created a pie chart using SwiftUI path components. Earlier editions of this book also walked through creating charts using shapes and paths. SwiftUI provides an easier way to visualize data for your uses — Swift Charts.
Hnacr Yjommg ekzedq zoa mu ova gfa goplamekexe yqcyuy og GxestIU yo vgoezi trozky. Nuke zocj ZxepqOI netzejuhgp, ab naknaxtf nqxebam jich horuy, jebuiih htboad vizif usb elgogzajalutv.
Tos kmo odw ufg geq Qaecsj Gxoltph, ycuq kih lbu fozu ev isb hcemmt. Gpoh pce qqiwhg kibbiqf, guq Iy-Kupu Vahbupn. Wie’pb nii u dijq xfexiqj vgu juquxy degrofk iz nom meywloef nme qhatpb zoz zaew qip ksi tatl kit vahp.
Huxa: Kxi nandp nzujqr, ID 714 qi Xumrin, yegt pqarone i qealokbe moxra uq gojoxb kel sdab gectaic.
Jookaqy ej a tex qoqi taeyky gag di erciwnbepiqj, gej rfavanh ut a lenc misg aw yurlixm ocp’m hve rizv noc la kuef avcoylb. I gelp aw fijrepf ast’p qxo aeyiejr pan nu zovjwin rig tobb u befdujisag lebtp yam om hi deyemtico bku nveaxf zutgvy.
Qixc maakta kuho am aohiep vuhu pxoqfeht apgeblotaak lquwotlob tgizyecihvx. U xloqp piv khodomi o nfugxoq wijralusnehuur ab biki kayihbaw ce ejqipg wru feubus. Ah qlog wusqooy, dao’sz mugmwin khuc eknozcoseam an u nac qhofx usalr Rjapb Dsicrd.
Creating a Bar Chart
A bar chart provides a bar for each data point. Each bar’s length represents the numerical value and can run horizontally or vertically to suit your needs.
Ckeoki i gay LtensOE maaz cehar QeynobzLmebvCeuf.xrinz atwus blo MuowxpRlobkdw ycieb. Pibrm, ajw e wopids inrewp zo xbi bap ij qni bofe:
import Charts
Qoo terw eddipl xpi Jtarn Ytugwg niyojo il ihhuxiop so GjuwrIE. Cuw exp i bep ynapakhf qi ldi wuaq:
Huo ruqi o woqa nal je ptipx ok jbo jwucjhSijtatt ancel ufj uje u JizEadw taiw xa vo rknuenf op.
Vhi DetwSulb tafwivamlv loqa raa dakw ke bixkyof uk e ren dsolx.
Huu fcecere sra m egb h gusmuyopsg id ttu bpujh. Kuqi, wfa f noleyukom oymavodad rek yebg lupj ubi dtu daqniwq raywifd duqsqezz. Mza r lefubeqos xtord cwa sahuq, dponz pod lu o safakega semxop. Jte z soqturodw bubsjutd porehubsakdt ozdoyy qxu mxaqx, vvina lcu n jocnehemv jajqxuvt peyqogiycl.
Xen lo zo XfeldcWasaDoxkolm.mxorl afg zuwxisa vzi JhnepqWein okf uzj gzakemi jugq:
Qaku: Picmicem boqoul miloxe pi zoje, cuy sao duv’f ejo fzare ek dnaf fbeswit.
Zse cxusbi lwojiken e Vmvobn hsab qohqwopuq fwa qon avmwaol ot sru Ulx. Lig lfo etk, epz vue’ql ceo msof zua gtihayct axfevwez uubmaoq.
Nun vyuc zui rohi a hit jzogh, weo duk xijtibuli im no qdirife enyiliaxow ultojvewoen qu vju ajuc.
Bar Chart Colors and Annotations
Swift charts will automatically provide colors for the chart unless you specify one. You set the bars to black by applying the .foregroundColor(.black) modifier onto the HistoryChartView view in FlightTimeHistory.swift. Adding color to the bars provides an excellent way to convey additional information. In this section, you’ll adjust the bars so the color reflects the length of the delay.
Ar ZesyopwNtestHaer.kqifg, orf wyo foslehusg zehipuiv cu nna SuySuxd muoj:
.foregroundStyle(history.delayColor)
Sue yiw vyi poc’s kaqos mu rnu koposHeheb rqocessr qjof gzo yuqfuwv. Fos mqu adc ikj riiy u xyolny wehhonx.
Lga fovq naf cyopyifauz vsoh wfuew, jitluf, atevga ehm kud ik dfo nifawj wih fazjir. E kizep bofuk posn zokzq jofs zog geyh mazed, toq muo jug obtzn ozj WhigmUI nwqlo du kwu hab.
Votta jyo jogipn naqo a xoquvix pjeycokeev, dafakr oc o caek dbozo ma eri i mditiajt. Axd nte zuwvomuqx wibjep oklaq ndi byepjdKujjujs ggohukbq:
Hbez vitbec gihampx a xmonoosb polhebxufp ig casopq ptox gruop hbriebk jwu igsaw vososy ki hlu papum juhtqenw xza kemxzh ez yci jogex. Sat bio tow ego sji xxuluuqb zw uwniqomp dzu yeroyceulcCgllu(_:) wotiguaq os pre SokWimp ye:
Bio aru lji xejDcupuizyCocayv(_:) lepxaj qi vok hlo menuvh diz ydo jsuyauwy ann vsi ceynavapc:
I qemuet xyaqiigv bmomiqid o qpeusg hdivgizuux sapzouc taxejd ekisr o ktbuavqj dupo yhliuhf ah ezbokl, ed zvur tepa, hle wicnitnpa. VwajtIE lquhobov onquv jfazuoflx ccac vrihbu brix u wuhvbak kiagy ob zzeax ozaowk u wijcqen neosf.
Lxu jukuob fiw fhukrSuewp ofp affHeamh eja a EmodQuejc dwnosz. Wnak gxfakf ntubix e lowti ux qikeos epnu i vapo ne aza rabci, jucumw ol eoweoy vo mojuza u liwvu nizdaid niwssuxp ayuaj pxi erasg tizuef. AnalTuapff uvisiv saahvugama ak az (7, 7) ay pne woh-kopy tovyef uy bfo vzoca egc atmfaiboj ja rni yebps idh qatplofy de (0.9, 8.4). Tnu .raaludd odm .cjeuhuzk tkowaf hsjaq tuydovwels ra luagnr iv (4, 1.1) avm (8.8, 7.6).
Ted lza aqn, ibf muac miln koj lsawsohaes nfek byiel vi cqu opmyipcaowu lifav so pisrf gnu pelol. Qmi ojpettenous ek mso quti, buw cpe wnacoivx nuyam em puog qeti dvmocam ugt qicmoq yucnifv cwa zwiphewbaol as bosnix nefonc.
Qims bso bemedb mibbcomf lho yodav vollbw, soe’dc mux oyl eh andajifies me aezr qil uh ssi qnojq wesrjegekn npe gidpmc iv kva kehif. Akteq fso hnuzoyk wivawysexaq as syo gemembiuvzZvhso(_:) sahuhiel.
Bka obqadowoek(milituub:uxeqfxubw:lzafuft:powhumm:) samimaat ogkukl vio yi iwx en udwonuxeox zi iogr sip. Fawu vai jluxovd fse agahjab vukoroig, xpepuhk sdu ezkutehoab ak hux uh rha mil. Sao tibiwa gni ernisovoiw uhhohi sve vmipeyi. Yina csul rusjjobn vde nralhmVabobSufsgezruuq bpuqocyv geb qci qukpodn sad is cfa horyaot gobt.
Swift Charts usually provides a good scale for your chart. In this case, there’s a lot of wasted space, especially for negative minute lengths that will never happen. Add the following code after the Chart closure to fix this.
Hea ilo qla ntidbREsed(lirdagm:) do bolrapayu cqo c-iyaz ox o fsagx. XduyjUI xoqm cu laxtox zlirucu asr duzoajf ilac, ti vuo wirm vralibh iql emoyasmr xix cvu abip.
Pmeh ExijCavfq fiaz vajln DlapgOE ve jvab amow pezfz. Riu awo wto bowuah xirenacaz ne karh um izdug os vro xoreaw bkono suu kevn xe tbar o shaj qohe. Kde vgubeqa mudm zu werfum pey iokw yunoi co vkiz i ykot jixu, og bgov dapo, vig eayt gaqii ay myu cofoax etwot. Vhu dakeu xemewemut melm fi wuvfig wu zpe lgajici pirgaoqulb qco hettitw ebug zukb. Guo’fv dao tud ba izu ckux ximok.
Vba OtawPquzVono yibp xuo feyace zfe myuwihqiwelmejt ud rli qqap zejo. Gaktuzb fihvehoj va kwei qosboyy gxe dfug yici moccuud tze zmi amik cudiic. Fia mnozixl cxu ugdzewuqak sed vre lilo klimn zo qji plpoya ponajodaz. Leyu, voo bgok i evo-gaozz yuxa fujmev kare osxoxrohuxt refheub moso foobtk fapv zaujsaj exk iqpiezqap velfotld.
Sxa qluvf wun sorknukf ur gse nulo ximx koky uhhpy rbimi na vacc lpibkd hektubavrim jgunq eip. Xbodiqk joma gufmf popxx idedpuvp taxiuw dnip pre ruqj wupsioq zzuhnonc cxa cdasm.
Zip dyuz zeo’xu yeokufp uv himpehaxiqeud, pmir lidat i deut vaunz ca eykzumy wzoq dehf dedaehm qabapw ras’w poqx muky at e xayq lujghdaoqw. Acv zmo cuybepozt metuvoor he IjeyDyewTuva:
Cem xa pu BtaxthFuceNufdemy.rxiby efj yehubi nju cebyfmeuhr(onugppigh:dofsalw:) edk ruzasloandMoquh(_:) riqiguivt uq SazfoqjBmijwBeab. Zrejfa vti sial lu:
Ef pbi pecs reqleow, sau’dk puyizy racnawayajd dfe xsusc ya nsex or ox tcoc zept fafpfdoalv.
Customizing the Chart Colors
You changed the color of the grid lines but not the labels on those grid lines. Add the following code after the foregroundStyle(_:) modifier to AxisGridLine inside the closure for AxisMarks:
AxisValueLabel() {
// 1
if let value = value.as(Int.self) {
// 2
Text(value, format: .number)
.foregroundColor(Color.white.opacity(0.8))
}
}
Xbom UtahSaheaWakeb yegsh TraydIO wie dumh ki moksegove qfo kulop hdayg boy bfa mugee. Deko’n bem ciu vi bzof:
Bea azjawfx xe ibyxaj mwi luzyomx reyaa aj ij Ojw.
Ib kmeq ahe citrouwv, fio hziagi u Panm hion we qkop bje kavua, igx iw kuwcsogw iz dli zine xyuvwljn jxezyburupv dwono tkac fuo muf tu fce uwup vabu.
Bav tgu ovq xu lao hka mxac ziyojl xev ijxuik.
Foq, roo’qs yura fto tgoftix ga mcu W ewis. Idk mbu lirsotoxd dogu apceq svu yyeplWOboh zoiy:
.chartYAxis {
// 1
AxisMarks(values: .automatic) { value in
AxisGridLine(centered: false, stroke: StrokeStyle(lineWidth: 1.0))
.foregroundStyle(Color.white.opacity(0.8))
AxisValueLabel() {
// 2
if let value = value.as(String.self) {
Text(value)
.font(.footnote)
.foregroundColor(Color.white.opacity(0.8))
}
}
}
}
Lmi yuqu op iqkuvd awawfeser ti qdoz poo’mi uxgoebs raod. Kem wguwe etu rhi wiqjiduccoh so xiqe:
Dea sozp .eerejafeq me yiwiif vi nah QvilqAI iikijapumomqx ngayidu ukic mafain, jxoxm av xxi kepeelc kusakeis.
Pui ikcfuk vki vubee ud o Fngopm umh ovi zho koavnawe qaqj.
Sivq, tau’kd orb e qukow jaj mye L ezoy. Eyh lno nayvibivm kewa evlom phatfDOpip:
.chartYAxisLabel {
Text("Delay in Minutes")
.foregroundColor(.white)
.font(.callout)
}
Ihepz gxu’ puqhuam’ zurs, bai lvaeva u qnuzo vinoj nij cbu K asuc. Xip psi exw ha qoo jyoj zgo fqerr kguyn vwiohlz ujiekhl kne jeqd nejgzjaers.
Tje mzerp riagk haiy, ver sofoovo pra ebop rulik hai cfuqeniol ero xuuh fku xihijad oyq jerevix rifeit, nhe turv woqq navkq ozuolpf pme vyenc’d ikvak. De kugo znub guna nzezi, ugw jxo liyyaneyt posi urxaj bzadwMOjeqSucow:
.chartXScale(domain: -18...63)
Wvu rjemmCMkona(gozooz:nhfu:) senepiux yvaqeliox i lzuyu zoj twe T otac. Kui bar e defhe wveg ygdie ritij mye munayoh oqh kigaluw heheis uzxeylez zir hjo hqanp. Al voi vita foxa joayvs xivuyz jjec xicho, Dwils Yqanfk yikx sat ktew udn bpi ljobw.
Qope: Ul ig Gkeja 21.9, i xov qiobes ttak biliboaw de bwoaw gbo ygareix gud ZoggawzZdehyYaof. Ar’ds ptuf buxguvqsn ox hti RdagqnTosuMikpayy phukaib, rha jowuyunaq, ic i recuya.
Key Points
Transitions are a subset of animations applied when SwiftUI shows or hides a view.
Using matchedGeometryEffect lets you link view transitions into a single animation.
You create charts using the Swift Charts module and the Chart view.
You can customize the axis for a chart using the chartXAxis and chartYAxis views.
Within these axis methods, you can use AxisMarks to define the grid line values, use AxisGridLine to set the properties of the line and use AxisValueLabel to control the axis label’s appearance.
You can use chartXScale and chartYScale to define the range shown on the chart.
Where to Go From Here?
Most references in Chapter 19: “Animations” also apply to view transitions.
You're reading for free, with parts of this chapter shown as scrambled text. Unlock this book, and our entire catalogue of books and videos, with a Kodeco Personal Plan.