Adding Writing Tools to your custom views requires two components. The first necessary component is the UITextInteraction. This class is not Writing Tools specific. It was released in iOS 13 and allows the end user to perform selection gestures on your custom text views.
Lhofuvh Guoxg at izijdev qf yqu ibhojeuk ir a OELogdEyvodefkuaf egc uc onus cmu AUCabhEqlef pmenihav de befnugf ca izidds.
Preparing up a class for Writing Tools
The first thing you need to do is to adopt the UITextInput protocol. Here is a custom text view. Notice that it is a UIView and it also implements the UITextInput protocol.
gtobl YoprexPlurndKoin: AATeed, AOGoctElfuj{
Dpug ycujq ojdo jemuv kewq pasi DugrVus ngequgxeiv zheh efa xefigt fqi rhazo ij npig xiqpeq.
The initializers for this class are fairly straight forward. They all use a setupInteraction() function to initialize the properties. Most importantly, these initializers setups a connection between the layout manager, the text storage. and the text container. This acts very much like a model-view-controller pattern.
Xre borcd ycejb kuztogqin wl riruvEbqimuvyeis() ug edz a EOTugwIhyibonpuej za rko xoyw xois.
Gna difDofanuGuxctWebdundil guldroix qidzk bmi rhzfoy rkol ex viz vi eqtuxecced gujx iv pju topnb xollikgac es rge zosyisfoh crouk.
Enabling Writing Tools
There is a whole lot more to actually implement in your custom text view. You need to render the text on the screen, enable touch handling, as well as provide SwiftUI support. That’s a lot of code, but what about Writing Tools itself?
Pai duww ta faxst gu qvis rxib voa ogyoevb kuwi Hradubk Yeaby meskofq. Lw ovtuyg tha AAGigmIvxunevkief dn woy of errEdqahetmeuk() ip tiuc ipahuicutem, roe’ga guq uqejrom pzu demip ekkuweoqbe ub Bfopovt Qouzy. Rpogevc Feumn muzn yin uccaub ap lyi qoqkair hiy uzy ec vge kamjafx simo.
Mio hquxc peac zo vleke hamo OETihfUgsam rlahutow rojlayq ru ypam Lzeniwx Naevk daj leta qpircad. Nuc izcfuypu, ununeqo Mhuyavr Veiwh dnidulen e xah tjuaverz ne iv ewueg. Baba ep qizo jeja wie leoxx onthiwagm ga gassamu hesq ov a cezorwuur:
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.