natmark / ProcessingKit

Visual designing library for iOS & OSX
MIT License
332 stars 10 forks source link
ios processing processingkit swift

Header

Build Status Pods Version Platforms Swift Carthage Compatible codecov


ProcessingKit

ProcessingKit is a Visual designing library for iOS & OSX. ProcessingKit written in SwiftšŸ§ and you can write like processing.

Demo

Demo

Demo Apps

iPad Demo App (Developed for Open Source Conference)

Sketch Runner Code Comparison (between Processing and ProcessingKit)

Example

OS gif code
iOS gif code
OSX gif code

Requirements

If you use Swift 3.x, try ProcessingKit 0.6.0.

Usage

  1. Create custom class that inherits from ProcessingView
import ProcessingKit

class SampleView: ProcessingView {
    func setup() {
        // The setup() function is run once, when the view instantiated.
    }
    func draw() {
        // Called directly after setup(), the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called.
    }
}
  1. Create a SampleView instance

    Create programmatically

    lazy var sampleView: SampleView = {
        let sampleView = SampleView(frame: frame)
        sampleView.isUserInteractionEnabled = true // If you want to use touch events (default true)
        return sampleView
    }()

Use InterfaceBuilder

  1. Add UIView to ViewController
  2. Select UIView & Open Identity inspector
  3. Set SampleView to Custom class field
  4. Add outlet connection
 @IBOutlet weak var sampleView: SampleView!

 override func viewDidLoad() {
     super.viewDidLoad()
     sampleView.isUserInteractionEnabled = true // If you want to use touch events (default true)
 }

Installation

CocoaPods

Add the following to your Podfile:

  pod "ProcessingKit"

Carthage

Add the following to your Cartfile:

  github "natmark/ProcessingKit"

Xcode File Template

$ donut install https://github.com/natmark/ProcessingKit

Documentation

License

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