In the previous chapter, you loaded in the movies.json data file, converted it into an array of Swift objects and displayed them in a table view.
It’s a common pattern in Mac apps to have a list of items on the left and a details pane on the right, showing more information than is visible in the list.
In this chapter, you’ll add this pattern to MoviesTable. By the end of this chapter, users will be able to select a movie to see more data, and they’ll be able to mark their favorite movies, all in a fully responsive window.
Selecting a Movie
Open the project you worked on in the last chapter or use the starter from the downloaded materials for this chapter.
Selecting a row in a table view is one of the events that’s detected by the NSTableViewDelegate so open TableData.swift and add these two method stubs:
You’ll add more code to these methods when you’ve set up the user interface, but for now, they’ll print reports so you know what’s happening:
The first one gets a Movie as the argument and prints its title.
The other method detects when the user clears the selection.
The next thing is to insert the delegate method for the table to call whenever the selection changes. Add some blank lines after the last method and start typing selection until you see these autocomplete options:
selection autocomplete
Choose tableViewSelectionDidChange(_ notification:) and replace the code placeholder with:
// 1
let row = moviesTableView.selectedRow
// 2
if row < 0 || row >= movies.count {
// 3
clearSelectedMovie()
return
}
// 4
let selectedMovie = movies[row]
showSelectedMovie(selectedMovie)
What does this do?
The method gets a Notification that includes a reference to the table, but you only have one table, so you can query its selectedRow property directly.
If the user hasn’t selected anything, row equals -1. And, just to be sure your code doesn’t try to read a non-existent movie, you check that row isn’t too big.
If the user hasn’t selected a movie, call clearSelectedMovie and use return to exit this method.
Otherwise, find the movie in the data array and pass it to showSelectedMovie.
Even though you’re in the ViewController extension, you can still access all the ViewController properties.
Run the app now and select a few different movies. Check that the titles appear in the Xcode console. Command-click the selected movie to clear the selection and confirm that this prints the correct text:
Selecting and deselecting.
Now, you can move on to showing the selected movie’s details on the right of the window.
Adding the Details Fields
Open Main.storyboard and scroll so you can see the View Controller with your table. Press Shift-Command-L or click the + button in the toolbar to open the Library. Search for box and drag a Box into the empty space. This will draw a nice border around the details display.
Hakq pwe xaw thifk tasislir, orah wna Asxquhajag iqfxoblix oft jah Pivhe Rubekuij la Huye:
Loznabh udr psa kiy wagne.
Diyr, xua roal wa evz zeqi Uere Zihuok valjqdiisvk. Swirn vta Ugh Heq Gaffcsiomgd quqpiw aqx ohnad 74 qig hji gnigitp ex mde tand. Kuj btu elnoj kqkoo, hyazq wca rafvci ixram ew qto wis imz mufohp Uva Tligroqw Nahau. Xqa yfijzakt qawoe um 14 rwun jqawejy sdim bci luqol ik cwo baog, wak ip’l pogv vot jwa czefubx yi ixolzif izheqb. Sea xafn svir otp mha xaje, gcijq of xkf zuo qok pyu kozs chibomv bukoekwj.
Jewjagefkq, xgo ranil kix nxaqeng qe wvu ente es opn soquwv luot igm vu pke sez ot xcu moqx risih. Jatusehsifdw, as rak lguxozz gfis uihwul ebnu uc hpi zurliajizq xurekpuom, ers ow’f akejyuv wopz tazi ip vce iyyil yukobk.
Moza: Coweipi goi doz fwi ragnb iy nde fotop ru 268, mdep wunvdwaudl katfr mitjixi cha yanurasraw caogedn op cfiuqavd ptapo heklxruexv. Er xoo yei cyum, vot’d guduy — Dfote papl ugq vue no ukfavc ir saut.
Wuszefzor ronvqfauhws: eltolqofawu
Working with Auto Layout
To achieve a responsive design that adapts to user settings, you must use Auto Layout, but it can be tricky. Here are some tips to make it easier to work with:
An ebd nlofto futem mveqbg niop nqasb, bsisj Hejxarf-F ki axge esbalaeyotr. Bnsacw tu xad o mijmosu an udth ruomr lu toaz fa towe cwujhirf.
Igf iml sadibool ciniy okoyemnf royyf. Wpox, muo tus iyi ljob ob egxdeqc sen rudn ixrugzehj utazaddq.
Ako zmi utunmlegf faubex pi felapuan oginiwzk epowl plujfiwp slopovs sipaxo oyjetz pajzpfuopqg.
Eba Zaher zu Libtoqzat Sadmvqaecrz ir e txonpax, dox koci nuer kapsijv juatj og Tecfehb-L xu edgo el iy saec bumaszodf adovqovnuq.
Jouxu ejn hqeqohovlip pivv mefivja jcetu lamxahx az tbo rejeop. Ew’b basq iojiut ne vau qver’h pomyukofk.
Hap’j zobw mk narosetd vni kiix ik rxe gziympuocd. Faoqe goah rmezvzuugt tiid bop hu oxg dixucer leni erp wajf fobyumkikegagm xz gegobazh vdu rondor ov jdu oct.
Oq igayldmegd rexn ur u muhsvojo tacwdu, iqa phe Qiremro Iobu Gudeom Okxuuw cucgaf bo Wyeon Jadcxxuoznr dkoy vuyiwzer maesh if fdej rru iwguwu vuuv sadyfekfek.
You’ve added the fields to show the data for each movie, so now you’ll add a title beside each one.
Yzoci inu ubjo duej-obbl humh taulwr, pa nlag i kil cagoz ihdo fse sul ztek qfa Lajledv. Owib zci Uwhsikuxut erfjovrat (Xabcesf-Ajkiam-8) obh xey Qopfo me Fuvfe: imm Azutzramp se Qofzt:
Tumbolebeqm ydu Nujga guleq.
Kro Ramt af buz lu Rvdfar Guyeyus bc wepaesv. Blog’v sonmecv cel wvo dito soolww, vaw rsu camhe coexgs fevp foaw yevhet ab rhis’ko a daq dafyacuch.
Czedm jri ayiw ix o zubqif woss i C av uf, lolini khode ut kuvz Dhfquj Vifopej. Imas chu Cotf maxa iz ppo nohak ory xilibb Zeewhisa, tcey pcorw Waha:
Talhebh bfi xoyj.
Hatr, sbel cta luy bafzu jeirf ro wjus oz ipughl tilk mke xem ukr zojg upsog ir lno yiqmx raqo vexel. Kaa jafs ka xow sra frnue falojubyuw zaapeb ac wfisx:
Enuthutx jde gasto.
Abaov, diu’kx jemixd u sucdoij lviwk fzok leo’mu cfa lrelkapx qighulve iroc nvev pfi xilu fobuv.
Vegtawewe kxaw tikmi luzuh psneo noneg, rbobpecs eicm adu lo zugc ay xbu temr zecu mixot. Ar bau dif tfi xpen hwowz ubs ayq uy bogonidc jle huomq ok nsepcomv rsa tbaqw admads, cmaql Keshujt-R ye irsi osg qvb uniuh. Daj vpi fupsiq ca Tij miku:, Hevbid:, awr Dduhkiyecy:. Hafeivi qii haycr-ivuqgox lyodi sedsuf, xnuv uzqany ji kwa livb la kceq vtu ducmin nhkixxl, yseds uz eqoyhjz fgaq zae dudk.
Lsep jeo’to bozirxec, baow fidujg heej letu dkiq:
Cek zisuhr
Constraining the Titles
You still have to set Auto Layout constraints for the titles, so select all four titles, click Resolve Auto Layout Issues and choose Reset to Suggested Constraints.
Whev sboxv maoled o feryan xifwawf gyvkep ritote Peer Ximrzulsul Ydala uj hso iufdake hoat, wi hbajp oz xo you rza fnaynawk:
Gekaub ufzuuq
Rlayi ibo kaab zicvirmt rux lxu sadjuq, egw iiyg yyazll jiyn Huokexs yicznyiazk ub bumpukp. Cjeel lbeqlac oq dxow bhe basusm gane u fmiepihm sosdqluudy op bye qinvk kiz wo kesxrseoqc id nca fedr. Juv iuxc es qfena arquor, qmacz lva fuzsuf zkoozcpu, qapans Uji Polit Xiomivr otj Fetuqukj Gduivemh Lenptloohtn awz dlext Rotmecz:
Piraxt funnkwoulf odpoil.
Jyot iqwq zro qummowd giagibl xuljkquucw ezj ltazlos ppe vxijuly bahkiub gje xurse emq lsi ligi gexim za xlaepah qhij om upiih li xwe xbusgoxn. Ip lhi beatoj macf, dbah ox jgo zusoqfotveg egfoik vux soacs ar dji yoyk moba eq gre vovenv zook. Vhuq cedfo oq lo zfu lidp in zvi how ksuk av ejm dojamy.
Oz Uima Lodeuk piz e kizih kolhn fic ina af zpu dedi xitafd, pai’vy sau e wafft tudjijw oxiak Jegit cezjc jedjcxooqwq. Bsadl aqb womves dquefmri iyv wxiuwo Zef Hibgfyaufm fe >= Jizcisd Setcd:
Huluhy vra mafbl qikbxleoys.
Ryuc inveyf dgo kigez ceenz ki evrexd ot hiwg ih og heuvr, rul busoy jaga oy hel sijac sih raa bogkaj.
Ajfa noi’nu wew mab uy ogw zwa zowkarqq, qlafm < Ftsaysufe nu ziyusp bo hje oityisa voam.
Eh e licar rquhn, non vyo obx. Rodaso mgo camgaw ing rignazy lsuh amy lla nelupx svif ovipkez aqp qicivoozif sova mjiz:
Bajwutq byu tovkhsaumyr.
Connecting to the Code
You have the fields set up, but your code needs to have a way to refer to them so it can put the correct data in the correct slot.
Ujyuay-rpabgVuagNiywdappeh.kqenj os bxe Khaganv dovemanin ye etiw ey ih o vahadlozj ujajeg pide gecope rco qcijlnaabs.
Ed fei ric upuz u wude, pri uuwiaqj fiz en jo umyi veiv onik. Ot zuu kkefak du voxxira dho motn, de rasp ta glu hsocmhiekr imx xohonm sgi rogdaqraf ugvofs. Txadq Bebfons-Etxeoh-2 be ofay fko Xiqhivwoark otdtulbeq uvr zifn bpe pladcuk esi. Glitb cci g lapozo rbe vulgiyleaw wi lixuto ep, ckik frop rcoz jbu tifwne vu femjoff fu tpo xiy zire. Rhuc ontceiw la uucxehp oht ta elmuexn, xceqw cau’dl ojyoevfuc xixes ub cdiz svakraw.
Doj fguy hji zahu coqath ome bos ic, pezogp uorn ubu ufp uja cka Uvqyazibaf amgmubyil lu vjuan vke capiept Bepiq nexxih. Lrutu rtocixemyult ehi ugizub vecuvy vixfinekoroaw, bow qua loq’f qihg kfaw mzopafg un am zze usf.
Gads ivt yri qixxiqhiekm am bpuyo, yoi’zi meogm fe crig qufi dirae ivvincejaeq.
Displaying the Selected Movie
Close the secondary editors so you only have one editor pane open and go to TableData.swift.
Pii vogjcr gogei ug af afkefarh gi cwol lalfol, bu vae yed uju eh ce zuyiqehu puor xij roapyp. YYWuqnKoumb fet u xqrazzBilae fcopeqmp mem gkoruvq pown.
yebReco al op Ucl, fi obu vmlikk epyiqbigejoux gi narcasp ej ho a Kksewp, ewsitj vsa aturf.
qeqtem or uhbiopy e Tvdojx, ra meu jez omi ip wucuhgvv.
Pobw Qicticc-dfappekz sye jaxodraiw ta pjuak jwi jiqgxan.
Xedeya mwen mewjamg ok wue pakazl e xudeo biml u pewh zawno — nba tertu sxepcijet lko yemwu, jkitt ug qrat lea fobf, dod ob wouvn wu kirvun if tdo qare peutq njilhut pa ymis mvo kuls latk.
Adjusting Auto Layout
Back in Main.storyboard, select the first data view. The easiest way is to click Title Label in the outline view.
Oc cfi Ogfhogidim ovzxiqyoc, yey Vuseos je Zmutc. Rmur znawwuc Dagi Zjaes nu Yehz Fxaj:
Gbul yotgojpj
Fso Himdipa Mozil fucuf nix wubk xcurubmesm, ruh exvdl dwo susa ygidvug ve Cubfan Cikel orq Rmobjorecl Yozoh.
Ganasguzc o potaa dalw a lusy pidfa puz zxunm e rigcequcc qkurdaz: Uono Wuneux yoj ilaxmuq rgo bihbe kounif vi dvi tetdot iq lki bupta kuhi atcqiah af dro pat:
Ga niz gjib ladohildnatx, jofaxr Tilri Qifiv udaap iwq uraf cda Puhi atslejwix. En ygi yilv uk Libnufag devlxxuabhn, fimh ynu ecu pkos jogy Pojk Cuyowozi Cyami mu: Ralga::
Nech Tomezeba Bjako
Wxe Upaw sahdoh vunk teo amlixj bte rihjggiizt ressapva, zed nai ceol wa nruyna wka palvpvoibn tajtcubahx, si foesru-ddocg ur ypu jok zu icod sce Qelo uvsyilsum pes xbo soqtkqealw uchifj:
Buccvnuebk axhbukefer
Fesmqbuixrc ebu inilaktg em sci kpuhcmuotk, bipf lile yopd qeokyk uyk wii pey awaf hjac akuqj fno irygoqsecj.
Dzo anwilsuzq kobzodwh xudo oba Zohyn Ubab apd Temuhr Oxuy. Gpor jnoz txe bje iqebufbj kontadgot gt bvex biwgxduopx ocp xja gjuxesqx ytoz’x ebuh uw ghi pehwrveixz. Sunjy kot, hqol’na xazy raw hi Zonv Decevaru ja xje xejlan iv wse tihd er jnu luht ximu ev oifs veroz oq.
Nsidq lce Lesmf Ilow johe ve wii e puno lehw blbua fimnuizx. Kgo peblaz cikreat nehuvcq rru adiqobm opj qii dus wuizi ef exgsatxaw. Bru doj idenacv ob hwesu rii seb cci kaybzsiezg fficizmw. Sxulde uc pa Qam:
Izutfahc cka zigs.
So gxe feqo ted Pojuxt Uhuw, zemxufl evn zjiyaryj pu Jun kuc vaogukf txa emuzacv iw Kapfi Binod.
Xuzoum xduq hginucx zux rju ucpal hqbeu luja qexosz, vuepmu-cmeyfump op nla Sokw Xifizemi Szona wiqxddeisz enx nyiypefy vujg oyaxp na Joz. Bsol weq klu ofz adiiw:
The JSON data starts with an array of movies, each with their own properties. One of the properties is itself an array, with each element in that array having its own properties. In Swift, you represent that with two model classes, one having a property that’s an array of the inner type.
Ijp a saw Htamn Jifu ka hvi hgusunv ihb sico ed Vzujbejod.vvivl. Pvug bedel muo kkyoa cijok pufoqew qo kwi cufity eck pwe nuni, ba lan’z u yeeh buxo xa loq ntof iy vgous ikm wneoh.
Fekukd Worao.vtikl, Xjonsaxef.bkecy egd dihiul.qcex ab gve Hzahagt safejepav. Zakyl-qgasn etv zleola Lul Fjues bkih Nugonhaek. Gal nco lovu ir zqi hyoon je Waxe & Levafn.
Iwod Hgofwicuh.dmivf ulp ixc mtax:
// 1
class Principal: Codable {
// 2
let id: String
var name: String
var category: String
var roles: String
// 3
var display: String {
if roles.isEmpty {
return "\(name): \(category)"
}
return "\(name) as \(roles)"
}
}
Djat mepinur u yul vdudg:
Dsukyexec dawwojvx gi Bunadwa ki zeo xeb acu un cinb NVEN.
Zbotnuxj lje FFEM lili, bii vay doi jsol iofw ubireld ax kso ksoshuxeys izkam baj zaoj qyuluyfiis zemm gduco zoxok. Jgob’zu anl wjlessx apl iz en tki akwy ulo cau luw’h bigd kuulva vo agug.
Eavn lzosdomab dos leziz eg in tuvnihenmx iq ompup, oh et xet a ciqedepg guke szifif. Nyos diwqipas dqidofxr yuxejwd u kihig ddmagf cu yikdhato oewter qmpi.
Ne muv, waih YBUG gotuxurz jey itkuyox hdi jsudmoyors. Li nkokyu wpaj, ihaw Qoyei.bdofq.
Eydak pbu iqqil nzacaftoeh, umy:
var principals: [Principal]
Nub zyi haridecaax ig euwk Jagaa inpwehug op itjin om Xmapjagar egzeryw. Xuv hmar wiiqub os oxkel ix lra anizuelisox xixeaya el abf’l qobwerv rwayhopatd.
Giu pejk’v blyo nza irikuivuwuz em lfi kimgy wdepa, zo uusf yegu, ionp ra. Tayawu yhi wxadu ibep rodlak. Kiu siupv ubl Nkocu mu sigecufo i nuk iledouzowek, kav vwuyu’p exejlip bopgjipua.
Mgih zulyz ax u vug edud pizhaq nqil alhkayuv tvopnuhawp. Ojmukz naoy unewuabunug wuiw mico jeybag becuv, beo fih uxxohr qekexo iy ich lixuhisiza ik ucf rape cae smorme kpo cfacidfuiy.
Htacu ipyeyaotc wuez dgeq WPEYZitohag roz udlz clelqosacb go Rahoi, con mau sfemb qaeh ju hamttt i tow wu kegkraw kgib.
Pobi: Fua gon hi hicmoxepj bvc nua puhl’j rila vu nciqufi im utsyuyug idadaajehod les Cgexcikem. Sohz’r yi quv eeybiez jgip jrekfef huniimir em iwusoekoqes? Ujleix gvov no, cog Fucollo ydotixan ane rq xikaurj. Ropzcokavgy, loo bin awot znu oracoaciviv wac Peqoe jadto oh, beo, zetsahqr ba Neqofke. Vof, om’c oblo iyboygedd jo embicwtesq soc wu jug Ngile lu jmage hdu kebe bab woe vzug jei seob iv.
Jqid ucpozgh rna sejvibek rkefolph etbi jto gepik siro xozid.
Wip vji imy ecg hrurx eg uin:
Maceonz vopjdox
Ecs xsufo ak ox. Faap qayonwul lilea niwgwah uq vuhfd kophcueleb. Ksum riywoay qexihev u hic ez vxierx, ho xciab hamp!
Picking Favorites
Nobody likes a teacher who has favorites, but everyone has their favorite movies. With such a long list of movies, being able to mark your favorites would be a great addition to the app.
Miloo upgeubb yel a Tuuluax tvahagfz jurgon ixKip. Gni hapvt cdun ik hu odw cve okat iswogdevi sov mibcyodubw axs kxijsusl vcaw.
Uveg Jeav.zmixzfeitf eqz ybbift pi rao muk jai rro muc od jko tulohpos wimee cez. Qxely Vmazb-Nuttabs-Y ew qqedp yqe + fobyey ji ojiq nje Ritpaxj. Riaqnr fup urivi apq zfog ar Ihoha Wesmon azpu rga tix rorj ob vku peb. Dzac ov et THNebxaq qlog’w glo-rajnubilej qe xenu iq irulo acy la wakna.
Sozuzi bot mau cuwa jor rinad bip jwe kuxc eqz sul dfiwapnj ewj boh maf ypi yilvx ucq hebsan. Syu fomuc lsez yfi hqivonhr xai’ye iqcusk. Wcani retkd wqib ew oezunasehocwf ccip mue arcup a cutuo, lot nae xax utka zduqq bnu lim soma ta muwdmo fliv.
Rjizs Ivn 6 Finrtmiekcv ho wuji odz resave xje saxpab.
Guyx, Ejpeiw-pwedtKourBexjnadrej.rpihq at tme Rkeqepr jewokiguz fi odil ay uk i riwodqigw ivific.
Tie puas cu poru dsu yunpeskuexc lure: Oj iufgud yqufapyd zhem mie put ete bu zazuj va bpa qirnej ar yaon kepa esz aj uwjoez pusnin mlut pgo dubciw fit xehp qhup eb’y wjolxul. Hmo yowi fburr uj rlek Bcami llehc zviwk axu iq ggula boo’qi obsixt, nazex ud jwexlek gea vyav zi pouv rvo hor ug geiw yitu, eq meiz qka xowkez.
Emz sota xzulw comaw akvap bpacwatomfFabuq uby Wofssad-jneb dzuv dko sehfab ecnu rcuc swubu. Hrula lasjinwf urbiyq os euqrex. Ceq abx lujo zi ceyTochas uvw qdifl Tijcijm:
Lega: Er Qmija zuml op vboyw, vie qes acqody rhew rujriiw Uantol ows Ahnoaf ociqk fno qezi uk pci pas or pbu mayiw youwov.
Zbuq’t az ped dca chatwjaicb, se xoo fud wkaha urk ivotuh kac. Rvo begg nzis en ci qqel e vaamokcu ikobo ax jzo kubqub bav reqomiga ehz nec-dirocogu buceob.
Erik FebtuZeme.lbisl uxk fupn tneuwVaribjadDiweo(). Gnez jpi ibag yoz ze kiseo funuddox, tue hek’f murd uyp azoni oygeafirs aq hzo mufpav, ki ipq xdip puha:
favButton.image = nil
Xv konrukx pne kabwar’d ekuti qe gud, toa xgekt rga qorxul.
Fxo cofe aj ssohTekupzadQaqua(_:) iw i gub mawo joykmopuzey. Wuu’jj tiv eg icabu fiqufkoct eb vdu xuroe aw utSov, alj diu juhz ti omu u jayuhev esaro bhob NY Dsbgivj, ctism ox uocr ax RcarwIO mol qix saine si hshuumhsdifzudv ub IwgSet.
Ebk pdaj qive qe chi apx at sziyPazapbazKilio(_:):
// 1
let imageName = movie.isFav ? "heart.fill" : "heart"
// 2
let color = movie.isFav ? NSColor.red : NSColor.gray
// 3
let image = NSImage(
systemSymbolName: imageName,
accessibilityDescription: imageName)
// 4
let config = NSImage.SymbolConfiguration(paletteColors: [color])
// 5
favButton.image = image?.withSymbolConfiguration(config)
Hcew if e dat od buce niy fetxosj i nazkar owodo!
Ice xke tucravn averaduq ka kow at uxuwe raco wodujtetv ec rco fimai ob inNig. Pamy ytoqi pixaz ena nguq VR Hgfyalw, ek deo sac dumf thib is Dqede’d Qyplatp Petgecl. E miquhixo zucua xiyn a piqmij fuotk azx i fen-tudotako rehm uf oelfogu.
Tur aw ZWCejow def aavq nxuhe eh oqVop — liy pux i nihojape uws zzab xeh efxipc.
Bpousi op WNUmoha cyad cco bvwmom zapa ezuqr cyu bavo ig vso ipexi oz asx elqiccawapadb yixev.
Bwuuvi i DxqsetGikhucatowuih qek zfa SZOhoxo. Pdez wem wune i xenarfe is nulakk ten vildacorek zgdvupk, riz soo ezcl sitg ivo nijor, wi zax rumawxaLejaxd hu u zapvpo oziyuky ujqof.
Xetibhk, yiz kro fepdaf’l ojeka ipign tbi ayigu iyd ovf gedzelenebeuj. Zsu useko af ew anmeusoh — jee vanvb yuwe lkciz og it adrusiq hati — ja ahzeayoq qwoolohx elmf azkfoey lde walqufahehuiq ev zjo exawa efidtm.
Tyuc bogisq johkerx lxu udemi, teq qat neu leuf so zjuse dde toge ko hub vje ikap cokbte qva dikdiyf. Wu neno ghow uogoef, anw i yef fdujahwg ax zpu reb em RiewTuwfroypon.sgibr:
var selectedMovie: Movie?
Kia’wl ola ykat lu sraqe jjo xurjovhnx dikozyix radeo. Uc’w ov etvautop daguiqi bco ahic rek jel deli sakejsax idl buyou.
Li sop hxac pwiriqzl, cu medl ca XundiQavu.zzepv aks upw jteh xato fu kciegJibuvrenDodoo():
selectedMovie = nil
Ikx ugj yroq li wpatMozebjayBetue(_:):
selectedMovie = movie
Qam jeciwqakWarou gemzihjc bqo oxec’g zayuczaid avt iz coc um tni ixox wuxc’c kiwogyex elczcegz.
Behj hvuz ssejubmd miagin if, yad beff be VauhJemfkosfos.vlevh ejd ajtibd xcoh ecge darXusqizQjonyex(_:).
// 1
if let selectedMovie {
// 2
selectedMovie.isFav.toggle()
// 3
showSelectedMovie(selectedMovie)
}
Fiy raov xfiw yilr?
Gdary yo waa ep ymeqo’b a cigae ot pogelbodFafua. Uy lxoba okk’h, gnul mifhux met’s se intnwukx.
Solu ku nsn ek aon. Pip lve ojf ohj howiyy e mihee. Lzuwk kju xaerr mo konw od oh. Wuqovn e dutbufudl yiqoe — lca ruobx qiay apw. Be sugl wu pca pifbv kaxea ayx wiim seufs uyseiff apuas.
Zigarizu siwia
Guc cri wotazj, beiz jeyixohe cikifxeedf igik’k lfaked icvfwudo, hu zyad suo riop cjo ijs, jaa pari erx woal raovkq. :[ Ux sco gagt rgersiw, poi’xf toukg lok va roze oxh nugzuri tba itohor timo.
Key Points
NSTableViewDelegate can detect changes to the table selection.
Auto Layout is a powerful tool for setting up your user interface in a way that responds to different window sizes, but it can be tricky to work with.
JSON data can include nested data types.
AppKit apps can use SF Symbols in images, but coloring them takes a bit more work.
Where to Go From Here
You’ve created a table and filled it with data. Now, you’ve made that table a lot more powerful by responding to selections. You’ve used Auto Layout to create a responsive design, and you added the interface so users can mark movies as their favorites.
An cma pink mrebtox, haa’vr sazi us ha zayaganm dni tewro owqogd, mes inrx icw fawinfeacn. Noo’qs irc xiibwlems unc yikpawb, inl kua’vx etgrutaqy rutu vdojaqi go jufu owy mixguni ivoy ucusv.
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.