-
Method used in Kineto
-
When using the native features of PencilKit, the freedom is limited, and it is not even possible to take strokes individually.
- (I think it became possible from iOS 14 onwards)
-
As an alternative with higher flexibility, there is an open-source software called SwiftyDraw.
- https://github.com/Awalz/SwiftyDraw/tree/master/SwiftyDraw
- With this, it is possible to handle each stroke individually.
- Functionality was added during Kineto development to encode/decode strokes, so now it is possible to convert strokes into strings.
- PR: https://github.com/Awalz/SwiftyDraw/pull/40
- (Dealing with specifications like CGPath, UIBezierPath was quite challenging)
-
If strokes can be converted into strings, they can be synchronized with Firebase Realtime DB, etc.
- Synchronize the contents of drawItems.
- There is a negligible amount of lag.