To run the example project, clone the repo, and run pod install from the Example directory first.
PencilkitSwiftUI is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'PencilkitSwiftUI'import Combine
import SwiftUI
import PencilkitSwiftUI
struct EditorView: View {
@State var canvasChangeObservable = CurrentValueSubject<Data?, Never>(nil)
@State var canvasData: Data? = nil
var body: some View {
GeometryReader { reader in
PKCanvasRepresentation(observable: self.canvasChangeObservable, data: self.canvasData)
.frame(maxWidth: .infinity, idealHeight: reader.size.height, alignment: .topLeading)
.background(Color.white)
}
}
}notemate, yagiznizipli@me.com
PencilkitSwiftUI is available under the MIT license. See the LICENSE file for more info.