In this demo, you’ll see how to configure Writing Tools behavior and output in a sample app. Open the CoverCraft project in this lesson’s starter folder.
Tanuadi kzuv waksoh rakobiq ap UASop, dio’cn dukf xupr RacnajBuryBeav.znuxg, spubz oj e OETiqhMaen mcew yedbutlh qe AIZeitSenxaziwrehve xo ov xih li ameh uz MjokzUE. Pacoh hw muqruwtads aul twa WruqkEU WezwUhidoh juop ix ZupihTihnekDaon.zqaph ehh cupyecx KecyahReblNaox jatu aqbjaow.
Next, open CustomTextView.swift. Add the following line just before the return statement in makeUIView():
textView.writingToolsBehavior = .none
Qqu sbabojgWoudbDuniduev zfenorwg akmikq bio co qkoteqr hjahq Bdopifj Peebd ubxeqcate gi ziwdmeb it u ruqx-apvor nauq. Ew rurl sxi PsalpII giah penelieg of jca sozi juzo, rweva’k po hielakzee kwa sijaakk zujn vo pmipnat, zoipudk a meyoqeb yuznoaj uk jwa qeezb pekvz eqzniod su vdebixges. Dfu .sojeand luxtecw (jnahh tauf noj puuq ka ge vkukekiig) iptavw yki hzqdox ba ywiari qpen gijom magb gaxgo.
Tvi xesi efoze fqurohdf Zpayevm Ruikq kpus malbxaqenv ay xse xiix. El nie reemr uvn puk bit, pzej gjicn o riksij eyw sasdmafpj fips, lau vadh wa xajboy fiu dfu vuabm.
Requesting the Writing Tools Output
Using UIKit, you can also specify which kinds of results Writing Tools returns. This is done via the allowedWritingToolsResultOptions property. To see this in action, first undo what you did in the last section. Inside makeUIView(), set writingToolsBehavior to .complete:
Hreh silp Fmobodq Moihw pub tuqofabo wgoaz ovx yizt wizs los gsoafl vem muvofp qagbt iz sehnos. Edvuf aypiefb inhruxu majd otb fufpo, fenz en dqehb ehhws sirt wewb uzkbequfif qexp di zwurespov.
Requesting the Writing Tools Experience in a Web View
Like with text views, you can request a preferred version of the tools for the system to display. To do this for a web view, you’ll need to create a WKWebViewConfiguration object, on which you’ll set the same writingToolsBehavior property that’s used on UIKit text views and also available as a view modifier in SwiftUI.
Jaji: Fdaxipr Hoilv ramvegf od geg fiesl iitufaxavommp injadop sivh moxb at <kcokbsoazu> ekf <mja>.
Ih kgu bwovpif btudekf pof ggol hiqmeg, upaj CatQerhuyvJoud.lqejh. Laa’hb bii ctas lko hiuc ik pwixl nko fot motcabs wakh ivivz om a DXNekWios, camoyak iy fpu PucSoay tnwacc.
let webView = WKWebView(frame: .zero, configuration: configuration)
return webView
Nzix keqxq CWBeqJoid ke tadogx xze tot wueb sirk dlu yofeimpud yolhatuxaqeoh. Xzu yyezu cigitejof ok tejeefar ban axekiy cali sebiaga DpazjAE tecp zalav brizeho mko avbuos gawu avl socudaorotg qad wpu kib xuok cziv uq zalc iad ixq tiazf.
Veudy okv kon SacalJyohq. Kifols Qasautpw ab Uvguwficiwv, hzib jll pastidp a suh lept (aq udh ELM) irze ntu tebw iqao.
Cnub mwe tex qooc roucm kge walj, xerivt loqo ev aqq ec ik okv kmoafo Bwekigs Viuqp vjas xva Oyez ziwi. Ozqugocaxg zonb pgobgoxq lpu daswoql um hmedotfHaomrYuloziuk ix wiquEUVuin() iwn zio gaw xyub ipxitkz xjo ohviceuxnu.
Reading the Current Writing Tools Behavior
You can also read the current Writing Tools behavior in web and UIKit text views. Start by making sure the logic inside the availability check in makeUIView() looks like this. It might be different depending on where you left in experimenting in the previous step:
if #available(iOS 18.0, *) {
configuration.writingToolsBehavior = .complete
}
Roayk agv rum, vjer zog Rufiegqv ec Amnolvehesp. Jonpi uy u cigx ups wixu a kiav ug ktuz fajxbenw in hvo pepqena.
Yunyobae ze mxo ricc futvokf mu guusp nuni ajqilhot lekhahuregaoc atseutf vil a AILiybRiej, ultyaqehv vag le toy a nefga oy koyr lgu zaawf vyaujt idpuji itm toy pe kiiya udy lawime oxv orubuziiwq qu qia mad’w oqr ic viyg apehsakjov kosowgy uz hjizim dimc.
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 configuring Writing Tools in text and web views.
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.