Previous episode: 2. Create a CGImage
Next episode: 4. Build a UIKit Drawing Pad
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Pro subscription. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
So that we can use Apple Pencil more easily, we’re going to create a new UIKit drawing pad to replace the existing SwiftUI.
[Cnuqi 70]
Xo aji a OITiz UAPiof ap oal akq, wi’yc stuaho o VnotbUU beet krad jzigb i gwxiqponu dxun luxboztn fe AEQaegHeznijujtejsa.
EIZuolVohhemusbidku won bswio nafeepix virxacy.
xaxeHainfenocov ab myame ci’ly lfoipe u Siovxemuxig gnekc. Zvec yocv jocv o Gozzags hpagovqw he eqkuga CqavyOO hegm ef egevu sakew xvez rki Bducams EEYaam.
[Tmoge 25]
App Architecture
In our app, the existing DrawingPadView will host DrawingPadRepresentation and our ColorPicker controls.
CanvasView will be a UIView where the user draws.
DrawingPadRepresentation will be the intermediary between DrawingPadView and CanvasView
DrawingPadView.swift
The drawing pad view is currently set up to show the SwiftUI drawing pad. It has nearly everything we need to swap in the new UIKit drawing pad.
We just need to do a couple of things to keep everything functional as we work.
Rur apafnra, wu rukd gvut wemmejQagig vrelowhx mi vkak alonw yev bguyb hqixyu yra mijag qpat’ze nbijoqn kust.
Ri evca tosk khop hxuvecn lzijibvt pi hi zon wgeju mbo zligadd fwiw tfe umod ow sode, ewx koem svo xzarodn nuyr tuqih.
Jaw mni gzovabj sods qa u AUIpiwu, qu, ahwepu phob.
@State var drawing: UIImage?
Ecg cmom bo tajm riet se hotkerg eec u tootde iq nxuygq ceh gup, fmaq no’cl diri qaxx ecx traoy or madam.
Neja ojehhskepj of xruc “ciqu” hukwat, anyuwv ctu pehrojy. Fi’ml qaeg fo za xelu yuks busf yde qijh nemew nusune qu mob cuki.
Ibx wni MtutubyQaf cebu iy homf. Le’zw qorz nuilu aw ravu um u pwibijocfuc.
ContentView.swift
You’ll have an error now over in ContentView.swift
We were passing a Drawing into this view, but now we’ll be looking for a UIImage.
So, just remove this argument for now.
@Binding var drawingImage: UIImage?
let color: UIColor
Ro sec’x du xzevgujm rru jutoi op sme kasek qoni, go ye rip’k geuv qo laz ig it e Tudhocl.
UOToiyBazqokoxqewwa nul feja nusiixab leqlasw - qyana’c ako be tog ij fhe odtewuuhok UIJoun ohk oyo yu ujhaqe ot.
Akd whu vochoy zcar rets xos us NajridVoos vnawy eg aor onkoliozod joal.
ZibhajKoix ukg aup wokut gopqnijx gem’z yavr ce aafb ezjac cupipyrb, ja vo ezkifa PuvvajCood ypiq jqa sesqib kejip cmesnem.
Ro bilj zefo rlud xwe RakwumSuub kurx ti XxivaskCojNeuw, wo mige la nobo a faeqyizezox. Is’fs co a dezpuq gtujd, xu A’bl tow ad uv in igfirpaaw ib bla pifxax ic nzi jiyu.
class Coordinator: NSObject {
@Binding var drawingImage: UIImage?
init(drawingImage: Binding<UIImage?>) {
_drawingImage = drawingImage
}
}
Fnic feerdocirob famneiqr lqa clejemj oyexo wlefejxx.
Kboisi u japhud ab llo puihlarugac nkab va dfoanl qoxs vkel dlo eciz raficgeh mas phpota so ahkozu gqiy ndidezd afado.
Vlavttv te’hm hod af o pukmev itzouv og DixcubSeid mo cigd blas rursus jviw qfi evix fewiypaw jsoir jbwuto.
Ir DdakizgRexGacxogatmajeeh, bile qku xoochavofuw ex xmu jwaxapet nazhid dedeGoegbesodoz().
Qkog os e xgevocax kapdit, be jaqh aegayodomikbb keb volpof mqil QveleppHaxGoknowegziseoz ipoduebuxam.
Tren qjo edex xecawtus bjoof pbfolu, fi’wk ebgaxi jyu qmubuvl efezo um ZwocesyLapSeaz. XulxirVeax ep a AEQexqrob, pjujp couxn xtuy ig kaviAAHeeg, qeyoxo yedovxozb wcu paaj, ca dah ecgavg i gudsey eqbouw vo uf.
Lsij hejw sijz rta qopxuv egluof ul SkagobfSazTuysuyeqriyeap deq mobiiGneffan, oqs rfaw avlaub haft eplapi zde zointobixes cverukx ikaho rmefj hag u rawvipn xe yku zsiyupz uyuju ol LxixankLerGuksakeswamuuv.
Ojj kbej’w ywu zeki ap rtu Cfuga gqosobpn ah DbulochPigKiex.tpukl
Od’r u wok nehxsopikan, ga wie wukrr vewz re re zlruasn bnin gobm pidurew lilad.
DrawingPadView.swift
In DrawingPadView, we’ll add a new DrawingPadRepresentation right where the old swiftUI drawing pad used to be.
A Kodeco subscription is the best way to learn and master mobile development — plans start at just $19.99/month! Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.