apple-pencil

Editing PKDrawing in PencilKit

橙三吉。 提交于 2020-07-21 05:23:32
问题 When using PencilKit in iOS 13/iPadOS, how do you change the content in PKDrawing? For example, can I go through all the lines and change the color or width of the lines? Or for selected lines (via lasso)? Or add a straight line in our own code? 回答1: PKDrawing is listed as an Opaque data object. See this Wikipedia Link for an explanation of opaque data object. Unfortunately strokes are not exposed to us. Our only 2 options currently can be found in the docs under Modifying the Drawing.

PencilKit in SwiftUI

ぃ、小莉子 提交于 2020-01-06 04:51:52
问题 I'm trying to use PencilKit in SwiftUI. How can I detect in the updateUIView -function, which Binding -variable was updated? For example I don't want to clear the canvas when changing the color. And is there a better way to clear the canvas than toggling a boolean? Toggling a boolean forces the updateUIView -function to execute. import SwiftUI import UIKit import PencilKit struct ContentView: View { @State var color = UIColor.black @State var clear = false var body: some View { VStack{