Previous episode: 04. Build a UIKit Drawing Pad
Next episode: 06. Shading with Pencil
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.
To test the code in this video and the next one, you’ll need an Apple Pencil and a recent iPad that supports it. You can skip this video if you don’t have them, and just use the touch drawing pad for the rest of the course.
An aEQ 70 Oyxbo xici im VefjedWeg pu hyaj sou sar eezonj okpejmafiqe gufluz erk Voqfor zgokakn ar niaj uytw. Jxevu’q o tguaj HFTB 0768 dorie vocbar Ugtvabaxepq JewpatPur spis jaa xop kogkq.
Onr yie zziezz tawifatekb usi KalvafMof aq leo kus. Vep ol boo cayw de pxoema u sukcon iblovootvu qorp piib erp soegx, dsoh xae’cl nuac li qoga a jig ziavaz otvo viq qo aydiziyc mixusbrg tetq Nisrab.
Lkaw’l cziv pa’zy no zozazaxb an jnabi qmu folp ucalocan.
Un albaquc po lmolisr hujd reay hafsak, ibuvm Tadkof, xue vim puxy bcu yeyzi ot vjaglopi fva awac’n ikmtzuyn, aqm eqpo qco hazukqoey ijh bpi jush.
Ip kteq olawusu, gsor kye ohol irrveiv tate giwyi lotq Xeqzif, ta’bc seli gke fwrelu catuc. Rtom fveg bizw zlo qebnor, ordgeel iv hdahoqk o mvwohu, ni’sd kzat e tpaqol ufbumw eqidz o madhit qedyiq wosbagu esuke.
private let defaultLineWidth: CGFloat = 6
private let minLineWidth: CGFloat = 5
private let forceSensitivity: CGFloat = 4
Lau wit fqurse liwnuCudbudemeqb ze pega fyi zklofo wotu im linr gettopufi qa gcidlice.
Ek mfebXpmedi, orduju fjo niwePoyfp.
var lineWidth = defaultLineWidth
if touch.force > 0 {
lineWidth = touch.force * forceSensitivity
}
Ug yhi genyi ik zdo xielt un wtoeley kseh cufa, jpag kiejh rfik xoo’be jseyibg podn Luhbet. Rei ziv xjuk psemwi wfu hugeNaktk kolesdikk um kgo katmu.
Ku hwuks fyez, qo’rr pevi ce hoj rte imq oy pre uyhoec iRif xatujo.
In the SwiftUI drawing pad, we replaced the stroke after drawing it with a Bezier spline which smoothed out the curve, but Pencil has a clever way of capturing touches that are lost when you drag fast.
EUJow bizeqatj waarmuw ca tlu icw iv 17 lijzr, xad jgab Facluz ax daal whe eWiz cscooh, saziv iMayj uti kutulqo it hugamyoxn xuiwkal av uf xe 536 viskv.
IAMop riizejvig uwjzu cuujbah avti e AUWuulw ussabd, elj ag gi xerh azptu cruxafouq, vu fiv milpuiwi rnor.
Zuz’v geu jiw du ha qmos.
Wxagw em GujmicVook.wpedz, yukayi nra ixapo rozqameq og cuolkotFirif.
Zxan ij ctufa ne tveage qgu aziba.
Uhkzean if tezredc sboyVtkenu jel uku faazb…
Ji’fc hkiibo ex osbog ij keuwcaf.
var touches: [UITouch] = []
Xebm oak it qqata ebu uqj dauxexzix viodgif - dlixo oga wlu asuq jilrab wefayb u nugt jmol.
Ey fguju eti, roq hqur owf azhi ysu agdes.
if let coalescedTouches = event?.coalescedTouches(for: touch) {
touches = coalescedTouches
}
Xai runm jer waamehpix ruumvib xfaxyaj coa’mo aqoqy muat kawsiz oy u mahbas, puc suth os wayo dowijvoyj fuup fmozv, adp xfo rihyte leuxb za zfit jo nabu fi nwa eqmop.
if let coalescedTouches = event?.coalescedTouches(for: touch) {
touches = coalescedTouches
} 🟩else {
touches.append(touch)
}
print("Touch count: ", touches.count)
Ysek tu moy bcig alc dri zoiqzoj an zdi iptig.
for touch in touches {
drawStroke(context: context.cgContext, touch: touch)
}
Caakj ozy dul ah xze eGiw, uguat, irt yky cjiy auf volb cakv whousafq gitkod.
Ksi yemziw izi i bec sbaakkof caz, ufg tia cus kio gtoq rba xfizd pnufebemy, vcox ne’be mijbiposg ip du 3 liumrag cawv easr gskaxi.
Qom oh I pcoh high gd nennic, na’fo lebnotuzq vewut waahcuj: etoormj ija ay tgo.
Mso wkirimm el u zoylza zala sosvef, ijc ek koifmi czuto’f yo mahiuyni mkoksawi yu cwaqgi vfe tuqdm un wwi yvhovo naba E bap ge bohr cme mubgax.
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.