Tool that generates a UIView subclass from your PaintCode generated StyleKit source code. Inspired by R.swift and a lack of NSInvocation in Swift.
The command line tool in this project will search the generated StyleKit Swift code for drawing functions matching the pattern func drawCanvasName(#frame: CGRect, tintColor: UIColor)
. Then it will create a a StyleKitCanvas
enumeration and StyleKitView
class.
- Download a release, unzip it and put it into your source root directory
- In XCode: Click on your project in the file list, choose your target under
TARGETS
, click theBuild Phases
tab and add aNew Run Script Phase
by clicking the little plus icon in the top left - Drag the new
Run Script
phase above theCompile Sources
phase, expand it and paste the following script:"$SRCROOT/StyleKitSwiftExtractor"
- Build your project, in Finder you will now see a
StyleKitView.generated.swift
in the$SRCROOT
-folder, drag theStyleKitView.generated.swift
files into your project and uncheckCopy items if needed
Tip: Add the *.generated.swift
pattern to your .gitignore
file to prevent unnecessary conflicts.