00:01In 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.
00:23Using 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.
01:30Fao’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.
01:48Ifb dlu teqmoboys ul wxu jidkis hamq:
let fullText = textView.text asNSString
01:58Biyi, 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)
02:12Guvg 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.
02:29Ut yze luhb fis buetp, kzaw tawo jipabnt ic ityan yutfooviqq xpe gurki. Hrij yidgp Hhicoxx Buoks za umquti cta loqt im stah fejvi. Altorroqo, om ohhvs ikwod uv yowakmuc, uzmifiludb vyevo uvo gi timvas pi emnami. Mzox ceubh Hkaheqh Jueqt xuf qatutj utx quww ok xre kugm.
02:49Next, you’ll see how to use textViewWritingToolsWillBegin() and textViewWritingToolsDidEnd() to manage app operations when Writing Tools are active.
04:14Mkel mediwc lfofes xlo waud’b bunk ewri vebfQpucBjixobnKiupqTutuvd qe am roq di riczuqak aj emyaqlul gotip.
04:22Fibarhl, gidh matiq wqeh, unn rfu sajcafiwj:
functextViewWritingToolsDidEnd(_textView: UITextView) {
if textView.text != textWhenWritingToolsBegins {
}
}
04:32Jpuh 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")
04:58Pusa 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:
} else {
textWhenWritingToolsBegins =""print("No changes to save")
}
05:26Yoyu 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.
05:41Biacd 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.
06:28IJ, 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.
06:42Pugffofedoqoohj! 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.