Created
September 17, 2018 14:17
-
-
Save benjohnde/1787ef1071e672f46244d738060508e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function(name, shapes) { | |
const generatedRects = shapes.map(({ | |
shapeName, | |
x, | |
y, | |
width, | |
height, | |
cornerRadius, | |
border | |
}) => { | |
return ` | |
// ${shapeName} | |
self.addRect( | |
x: ${x}, | |
y: ${y}, | |
width: ${width}, | |
height: ${height}, | |
cornerRadius: ${cornerRadius}, | |
border: Border( | |
color: UIColor( | |
red: ${border.color.red}, | |
green: ${border.color.green}, | |
blue: ${border.color.blue}, | |
alpha: ${border.color.alpha} | |
), | |
thickness: 2 | |
) | |
) | |
` | |
}).join('') | |
return ` | |
// GENERATED BY SKETCH, DO NOT TOUCH THIS | |
// ${name}.swift | |
// GENERATED BY SKETCH, DO NOT TOUCH THIS | |
import Foundation | |
import UIKit | |
class ${name}: GenericOverlay { | |
override func make() { | |
${generatedRects} | |
super.make() | |
} | |
} | |
` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment