Skip to content

hansemannn/titanium-pencilkit

Repository files navigation

Titanium iOS 13+ PencilKit

Use the native iOS 13+ PencilKit framework in Axway Titanium. This module is sponsored by binaries included!

Requirements

  • Titanium SDK 8.2.0+
  • iOS 13+
  • Xcode 11+

Example

import PencilKit from 'ti.pencilkit';

const win = Ti.UI.createWindow({
    title: 'Current canvas'
});

const nav = Ti.UI.createNavigationWindow({
    window: win
});

win.addEventListener('open', () => {
    canvasView.focus();
});

const saveButton = Ti.UI.createButton({
    title: 'Save'
});

saveButton.addEventListener('click', saveCanvas);
win.rightNavButton = saveButton;

const canvasView = PencilKit.createCanvasView();

win.add(canvasView);
nav.open();

function saveCanvas() {
    canvasView.generateImage({
        callback: event => {
            const win2 = Ti.UI.createWindow({
                title: 'Saved canvas',
                backgroundColor: '#fff'
            });

            const nav2 = Ti.UI.createNavigationWindow({
                window: win2
            });

            win2.add(Ti.UI.createImageView({
                image: event.image
            }));

            nav2.open({
                modal: true
            });
        }
    });
}

Author

Hans Knöchel

License

MIT

Copyright

(c) 2019-present by binaries included

About

Use the native iOS 13+ PencilKit framework in Titanium.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published