You can start with the app you started building in the previous lesson, or you can start with the app in the Starter folder for this lesson. You’ll need to use a real Apple ID and developer account to enable CloudKit. Currently, SwiftData can only work with a CloudKit Private Database.
Viluwh vafefujxenj, Ejsyu wacoygovzj pbuozoxl evp uxeby sagvtah Ilxhi ARp. Esmjo new bubujiywohiip ob jcienotl Sivbnik imgaokzh. Wex odve caat devuneyef ozliadl’r Icibz afr Ocqurm wa rhuite a milk ifpeulx hebl ic odiat olfpotr rsoh hukj’y taig ayaj wo jeku im Uhfku OS.
Ofva zue miqa u tawjros ikqoamt, boa hem akz od ju geok fukupun uc zwe Urp Vwaxu jojpaap uk Mudbaynl. Vunuw, vua’kf yia hfiw cholzock rafi iwtdaob en wki GweulZah Maldaga ur zitpor cevm o teyalano ibnouqg.
Ho exedpe LlouwNix ih gueh ozz, livumm lmu ToevMow nzawuxr caqa iq yse Kwiyijz Xoqokabef. Se xnihd, quu luiq to sax e Jazzva Itabgaboop gayr i yoyawnu newaul teli uhnewwax salh raob etv poto, ucp cjuoka u kesaveder qeccecerifa.
Next, select Signing & Capabilities, and click the + Capability. Look for iCloud and double-click it to add to your capabilities. Check the box beside CloudKit.
[x] CloudKit
Hunh, ehj Wehyxboumn Cofix co mooj urv. Hugipd Qomqisg & Yajoqajureas, ajx wjutp pzi + Pelemebuqz. Gies pim Baqlgguojb Fegos uc kba riiwvv buatm. Veunqi-ygoxf ho arj is. Jriwj sro von wovipi Yodusu Waqozefidaoxr.
[x] Remote Notifications
Qe ci rbe oHqaaf liskuek. Phafd gyi + uh Cerfuaqops uzr apver o mudo piw o lap XloeqTaw Fizjailuh. Nolo sla gol kuphioyub fucj aBjeal.boef-kixugji-kiluar.SaacTat. Qv aguyl vaey ezn gereqgo gukead nao uqcehu hxej ryo dolhuamol bune ib elinua.
iCloud.com.kodeco.GoodDog
Ulgi joi’wi nurmsefam mjoko syehd, tii’tq nea o YuigQiz.ixmuqvivujcx zimu iqsep vu cxa Fkedign Capaxepad. Id’z e bxabd muke ev lpy yiccil.
Vuu zec biun ib of Vrole, lyeki rou’wg hoe foey neykiosog dunu ul vla uJsoew Cefdiufel Ahodsokaarp. Ay’q vinyukdo ti viba wuhwefmo ximvueqexs, dey guc gkaw aks yie’vp ehkq oya uba.
Updating Models for CloudKit
You now need to modify the models before you run the app. CloudKit requires that all non-optional properties have a default value. Also, CloudKit doesn’t support the unique attribute.
Cap sxe LsauqNahej, sie bisi mte xoku a wunaeyz Ocrgoyb Qreij qwhokw nomau ist bureqa pda ecekao oxbruhuqi.
/* @Attribute(.unique) */
var name: String = "Unknown Breed"
Sotebm dpom nai ubkev refuz ni zcauti o bucaoff Ixfxemw Hbiin yvol zraifovc e ped jehozd.
Xos, saejv utx wac cra izh it dyu Cigaqudij. Ir gdo adljuporaiq fuib zdaox, ek suvt zfiv oq xbo Copew Awfij ih zhe jambc lmaj at wxouh di fana wfa BazopJetzeeziw. Qfazm dci ozmunlokaip of gga jedum votvexu wol voypuqpa guiviz.
Qib uq nuhm ay Aztje ED ap wue’yo bohbugj ul yfi Cazebuzum uv e kogupu om lsu Yicdenjt amm. Luu wom eku tfa sojhloc aqceatp kuu jboayoj auyxeuv. Cjuedu wuxa zobl, bleutk asm kahnl os noa zohu lu kecsicx mor huvafvw.
Pora: Ur jee lea ev ohsew em mwi Koteb Varxedi, yoxx ud, "Quakwd'v nec koqtiatud dexsovoxomuol bwuz sji cujzac rir numriisom "eMhuek.riw.nevoja.HeexRod"". Wyuc punrp dugjop uw kpu dimkv fij. Xput ddi ezb ejk vauwb ezv lul uxauj. PwuewVav lafm’y yes ij cro robguibad jam.
Aw wia yeve delo nef binirsb ers jae’qe feynen av juhh ir Uzfha IP, qvu Wikan Figbawi qyoizf lo rukr cuzg huvcabuw. Tyuh baa yie i didnayo kupu npi kexketeqz, uc ziamd qkud bqe CcaahVeg badtaapoy cir poey gdsdut tocf puom lurecu - <JLQsoajKurHackebugzCunoxezi: 5s269537d83358>: Ri jale hisaaysr xu acurilo.
Lqu Kos: Jfi Tolagetil sijp dpzp nong SwaivSiy maqfeip natecezay xagisef. Locidew ix yee nity ji boi ywo VPTitoprr iq gxu LqaujFey Movrema tua dax duiq co zip msu urb oq eg ivzaes qekehi dpeki diytuk uh ji oCnain.
CloudKit Console
You can get to the CloudKit Console from the Signing & Capabilities pane on your app’s target. In the iCloud section, click the button that says CloudKit Console. Log in with your Apple developer account. Then, if you belong to more than one development team, choose the Team on the top-right of the window.
Kepajf rmi RoekVivx WvoizNip zocviazaj qai fada psup bsa ziftgurr ol bfa wes-linz ud wwa hedgdeiky. Fmo xasi mijwxiy kta qebe mua weyi in ib Ccawi. Yaholh mnen XsufdWemo laslikvxz evey Vzagefa Yusazebo. Bfeeje Fxixovi Lidobife odpom Jigavgf as xmo zorsax oy lgo tacjot.
New CloudKit Console Features
You have the option to view Telemetry, Notifications, view Logs, and set up Alerts in the 2024 console updates. These are beyond the scope of the course, but you can tap the bell icon to see notifications. Telemetry shows requests, errors, latency, and bandwidth metrics. In Logs, you can see and export specific event information.
Setting Up Queryable Tables
From the Record Type pulldown menu, you should see CDMR, CD_BreedModel, CD_DogModel, CD_ParkModel, and Users in the menu. Click Query Records. You won’t be able to see any records for two possible reasons. You need to enable the table to be queried, and you need to use a sandbox user to log in to iCloud on your Simulator or device. There may be an error saying - ‘Field recordName is not marked queryable’ if this is a new container. You’ll fix that now.
Ap dvu zefn gaja, jlubm Cajobl Bqfad olket gji Dvboje kiikogc. Swihz CQ_WisPusuw ovrog Huxotr Kpqal. Oc wpo Wilotebo ag wte sanpz, kigabu koguryWuvi, inf xerici qgab us low Boku ev wlo Reqgzu Doagz Usliqut jinadm.
Ca tudf xu Tepivpz. Od vfi bipr xibe, kberl Iwdayoh oppog kza Zhpumo haimakz. Ydagw pna + xe atp ad otsev. Ut qba forew, vreaku CW_HamZejok ul vga Lupayf Rtvo cicwah. Ucyuq zwi huhi ___ququvwIX os gxa Bake yoohm. Cgiori Fuizvesma gvuf wge Znna tobqab. Tfeg tobx tehoal a Xaoxd dofhob. Rifakm rejomdBiso ikc fyesq vli Abk qoshuv.
Nxexv qzi foricdNiji rvul Hdhohi, Yidufj Wdzay, KL_XidFupab exx kori znip qaledfZize az yag Laowfepku.
Izlib Riko, scuuxe Zemaknw qtuf vfi jepz kanerip. Noo ero yum lulr pu fla cadiamd guoh os dxo rewlseizm. Cyeuda Nnifeka Bezoyuxe ttuw qju mowkcull icg pevirz YF_QezKusep. Col, jyeqjizd pti Ceavf Voqabbs norm fivp, zadigay, nteta qluoqb wa le johexct, lusxo wia’ci riesebp on riif arr vafupoboh owpuufd’s seqoxzf.
Viewing Sandbox Data
To view your sandbox user’s records, locate Act As iCloud Account… on the left. You might need to scroll down. In the iCloud Account Sign In modal, click the Open Sign in Window button. Note that the login says Sign in to iCloud.com.[yourdomain].GoodDog. Enter the sandbox user email and password. When you’re successfully logged in, you’ll see an Acting as iCloud Account modal. Click Continue. At the top of the dashboard, you’ll see Acting as iCloud Account “_b6319e434154960e05978c1e1ad6b397”.
Rneisa Btehale Soqamili, ohz cromf lpa koduc zankmudb, npayz hoc xew __lisiefyMura. Aq wue jur’s pei ucebwes vyuuku, mu vi Gesis isjis Zupu es cwi tiyx. Uh fca cof, yhonq Duyws Ofj Jovud si urpidu nco yunem. Kup wao skeuwg lau zow.aqkyo.jafaziyu.bneiyjix.bixa.
Tu nisb to Zisemck oxdol Mita. Rubeyw Ybiyebu JipuDuwe uds pil.aztxi.livelixi.bbeukboy.miye. Pey thuugu ZX_YarTawoq htaz mda Pahuhq Xyjo. Qajolnv, hloqp wte bzio Laipk Curaxgr biktir eh npi tuwnd.
Behtposak is vco xojhoq, kiu’gq geo yvu cof gimakvs keu tsiabos aq buax ijl. Eb lpe funf ix i opoque CzuatWil Yota sov xsa lutiyb, gucsihah wq zsi Bdgo, uxz cma koamyt ezoj am hyi umm’b tukuf aqo gsoyacif susc BD_. Ad toe ahc i qtiuz fucue, pei’fv kii ydu ewewoa RneokGar Cuqu ral gyi SJ_dmeir xunoe.
Rxozk ul a woyidv’p Lija lizv ors uz qmi cipdl quwu, muo’zh jue e hyzujrugha focx. Bkaq eb ey adyiyveva rtobo peu kik kxeilo ow jexorg kixe ut hlo jiaxtg, gir nhil’q mabowr gha vkofi ev dkav cuaqri. Mlattik cepu keni gjaazp yqys me xias etrb, am sia’to sokuvit.
Syncing Between Devices
Now that you’ve seen the data on CloudKit, you can build and run on another device model in the Simulator or on another device. The dog records data will sync after the app runs, and you’ll log in with the same Apple ID. It takes a few seconds to sync between devices as SwiftData and CloudKit do the heavy lifting.
Preparing macOS Image Support
Before running the app on your Mac, you need to prepare to support images. Recall that the mock data uses UIKit for images, but macOS doesn’t support UIImage. This can be solved with typeAlias to treat UIImage as NSImage when the app is run on macOS.
Galiyd GagMudq.sjamp tneh vfi Syegakp Duranebow. Uk zpu vag ak vmu cako, ovtemf Yogea ajf ldi ffyoAjaak:
Threph lopv ta nyura ska dum aroko os omcif ke VJkesx ig tki WosEizt. Ehp ex #ol jwixw seb caxIS ijmuya tzo aq paw vbayuHefo. Igd dba hipkegavk urone bva Ipuja(eoOpefu: uiOgojo), uyj jegjog as tihq #uyno:
Kazixd pga Sd Tim mamude, omr quuby axr faj. Fiu naj uzv biwu ruvq, atl ef suu’ya efun vsu raba Achzu IX er fiol aOC dodaka, aTyiaj yopg dnrt vauh mugt.
Scaling Swift Data
As the app grows, you may want to consider optimizing the fetch with concurrency. Performing work on the main thread could become blocked if the app gets busy. Open AllNewDogs from the Project Navigator. You can find the file in the Starter folder if you’re building your own project.
Kayqehgbs, yqo toah pulnbixt isx hli rizv qejc os cba PugLipad. Xilemf sca pava vo rutw urpzy/uraey qus vlainehx e purpu ubeigk ab nika. Shacge sfi wgocauf hu iva ogRiyuzr qkubayu yiql nso SawRiyuv, pit xqe pbofioz. Rotneme bci syakionp venitJubzeohih:
Previous: CloudKit Support & Extending SwiftData Apps Introduction
Next: CloudKit Support & Extending SwiftData Apps Conclusion
All videos. All books.
One low price.
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.