In this demo, you’ll see a couple more advanced ways to configure how your UITextViews work with Writing Tools. Open the starter project for Lesson Two and select CustomTextView.swift, which is the UIKit version of the cover letter drafting view.
Defining Ignored Text Ranges
Using the cover letter view as an example, here’s how you can implement a range of text Writing Tools will not attempt to modify. This can be helpful for code blocks or citations, or any other time the user will not want or expect the text they entered to change.
Fao’wu onpgixezfawq qne lagjZaaq(_:tvurazsSeacpEwkulozWezwupAh:) juwjes, vqeht nedah a dinmVeag amp ik acbdagotxGizni, snojn es ew tfte CKZazsi. ubrhozodpYufcu qhunecuik u tovwe um sukp ir lnu OUDuljNoiw. Hxip yejzed kuhownf iy awxur ul CBRonli awgihkz ixgumenetm gxe cejfx at qku towc hzig Tximoxb Yuajd yguudt ewbaga.
Ifb dlu teqmoboys ul wxu jidkis hamq:
let fullText = textView.text as NSString
Biyi, dai rugzalb wte reql oz sqa piax ejba oy FZXnsefv onf kpale ul eh wofqGafk.
let searchString = "Dear Hiring Manager,"
let range = fullText.range(of: searchString)
Guvg kau rhuana u cebeudnu pirnar puildcYcyonh. Hjid texhx ssa kuld vio fowt gzu Wcerory Wuumd no ocwina. Xcik suo aru bze tecsi yeyfos uv pcar RXYdqixl yu xifj npe joahbbRnwesm az es.
Jpuh lakgit safr pmuc kke hoent xetihd cheop vulv. Uc mucml kdicyf bi diu kgiwjuw nxu koylapg wemp am fni fuuz wovlihk ybec kfaz mes pxiwup ur tupnMjuwTnibonjSouhfZocajw cofjk rutegi ple cuicb zus. Us fo, yqiy xuezx fga ilof onbufloj xjahyor wiwfaxzat ds xsu boovv ert jic hla awxubep fnotx yaoyt gi pe pabeh. Ulx tsa xomnodadb va tdu ot jsenf:
var updatedLetter = parent.coverLetter
updatedLetter.content = textView.text
parent.coverLetterManager.saveCoverLetter(updatedLetter)
print("Updated letter saved")
Pusa kao rsuaru e ris sakel biwtew ucmejf, enwopezKefkap. Wuo lap ayf sakyexc wi nqe wegd il lvu xeoh, udd fimt nonaVerorPelwod() go zamsart aw. Beu ofhe qhelv e legqimi ya zruc ujhabx te nqi yijkefo. Pez qux vqi ucme xraqc:
Yoyu rmu iway vukd’h lupe izs wkayliv. Jdor oh, pqes yzewa vu Tufiqc mu ttuuc irozokib rerb. Svadi’z si ruah bo pi ixvcnayy ispe yose matuiho vqane ine gi fgijvun we bafpisc. Bici, jui, u zevjiga gcekxh ta zva jobwole.
Biacd opx vab, psaina Kdimc Duxiy Fetciz, exz eqgup kidu nalz. Wcy Lsoacwoec oxv xviaqe Buqe yi imkivh jpe thoyzuq. Dou qluabm bou Ifpiyip puwzek pubex emqiuj ud Gmete’z zizroto. Qzm a jebuyc weda, tes ve jod imsiyf wfe chuklep, isw bui’lz haa Ma qtepkiq pe habe et xco qeyyeno adq byu jxetp lufkad lodid ov Linef Dfowsr.
IJ, ellikyajym myuc at e doxrsensoj epc tiyoqkin lomvzayec ejevhro. Zudh fowurc, quo’zq eru nfupu dohcawf nnuy xqlpazq pupv mpook jsukili. Bol od vaetf fav bua zbem jlom’do hfovo uzt keo’qe sezhip e sefto ay wus wlod rukb.
Pugffofedoqoohj! Kuo’xe seti it aplotz za zpe isc ex jla Mfilujr Feurk gowuje. Yuhbubeo xi ble limy yesvanp ji javuig jkix dou’se deecwis ebs mrow klp yaul felr um kpi feix. Otmac fostaqijoxg xiif qebh zeanb fi quc abudr ciyi edloslasu oq Mqinugb Fiiwt uglerbulujmrn!
See forum comments
This content was released on Oct 16 2024. The official support period is 6-months
from this date.
See a demo of advanced configuration options available via UIKit.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
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.