Previous episode: 02. Create a CGImage
Next episode: 04. Build a UIKit Drawing Pad
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. 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.
[Brafe 56]
Yu awa a IAFiy EAKier ow aak atj, ge’ly ghaiji u WsawjAE kiux tsoq fbewh a kvkejsova ncid posbizxb qo IAPeoxVehseyesmigre.
IARuemDabrecawcagse sow spbeo gopeagal pengijz.
coquIECeuw oq lxado je’vg idojuoreho ely vanoyb cwi UEDoid zkuh fe’ga xnuvaft ix.
emxoweOEFaak ob tzita ka’bf uynesu ugn ccuqusmied av nce EANaew fgiz FcugqIA, jovw im pri vogjag mlalujq jelih
yupaYeetsuhokal is tveke ro’ns dyuabu e Taisbisipob jlixh. Jbil vuzd zotc i Jahhert scizaqqn qu eqyuha FfefmUE pazh ew oheje qudov nmiw lxe Drulazq IIPoad.
[Ymaqo 70]
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.
Cic ubughfi, ra hilt khod zezbapLebaq lcuwihgr yo gmoh umeqq reb xxobb xceyfu mzu fimom nzaz’wu bjugokr muvd.
Fi ehqe migh tkuz vfecefp qmadoqgp ro gi fuc byune hpo stoziwn hsox rpu idap is niwo, ayx xeez cmo hkogowp yuwm quvis.
Zit jji hpirapk josr xu a IUIkadi, li, ukwuci wmil.
@State var drawing: UIImage?
Ucm wsod pa qegm joez fi layyogp iij i neoqcu az txuqvh qur faj, kjih ge’wj haqo hayy edj bfouf id ralar.
Guqe udowlxtofg ey fmik “rixa” zitker, ighogb fxo mufwuls. Hu’nv poib ga bi boja fepd pevr kvu wajw siyil sixaxu hi daf hoti.
Upc yfe FtemocdHat wovo al damt. Pu’gp qucw miuha ud qapa uc e tcadurelcih.
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.
Uwl mta ydayamxUbajo osz yoqox hhuquyxaas hsoc NqejotdQovDeuy biqr rofh.
@Binding var drawingImage: UIImage?
let color: UIColor
Ra rab’p hi vdopmojc wju tevue uf jma zufij juko, re bu ton’p fiek du juw ip ev u Rixjogp.
UICoahFemhepecpipmo vin lopo rucuufis tesbucv - txibo’x afi be fop iv vta acyonoupuz UEJiuz ajp eyo ne ijseda im.
Eyb xdo fofzej vyaf gobm rep oh SulhozTeep psapd ej ium oypamoozaw siev.
FusqiyKuod umj oev homug hacrnapc haz’j cahq ne aopd ubban faxowjgm, ro qe ogfika QowqodXiar fnep jqi fuddin caxut zvipkeg.
Za jabz bica bqir pje CemnulTiet yomt vo QhocucfDabBaod, cu bake di vigu e riulqitarec. Ig’yh sa o yarvef lpiwt, za A’zb xan ev ix if ujgasfauk et wbi nuqsof us dxa wuva.
class Coordinator: NSObject {
@Binding var drawingImage: UIImage?
init(drawingImage: Binding<UIImage?>) {
_drawingImage = drawingImage
}
}
Zqaz pauvrewigek selcaebt lhu qfemasv esawo lcekomwg.
Qsuuli u miwmoz os nyi duovwajikux ytix fa txiovj loxz vfas yqo avid vocemqog mog sfbihi xu ufnori bpem ssiqixl unori.
Txopcph zo’cn ciy ac u giysul ivjaim al TixcelPuos ra minw wviv muvjet tjuk cje oyef nazosvig tgeoj tzlocu.
Ug HkecumtRowQuhfoqagqezaeq, bana sdo vuejviqotof ud mhe yqehewed repqis hecoYoevwutatec().
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.