Skip to content

randomtask2000/Pencilkit

Repository files navigation

PencilkitSwiftUI

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

PencilkitSwiftUI is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'PencilkitSwiftUI'

Example

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)
        }
    }
}

Author

notemate, yagiznizipli@me.com

License

PencilkitSwiftUI is available under the MIT license. See the LICENSE file for more info.

About

Pencilkit bindings for SwiftUI

Resources

License

Stars

Watchers

Forks

Packages

No packages published