Closed timrijckaert closed 6 months ago
Hello I was wondering how following Swift code could be generated:
extension UIColor { public convenience init(hex: Int, alpha: CGFloat = 1) { let components = ( r: CGFloat((hex >> 16) & 0xFF) / 255, g: CGFloat((hex >> 08) & 0xFF) / 255, b: CGFloat((hex >> 00) & 0xFF) / 255 ) self.init(red: components.r, green: components.g, blue: components.b, alpha: alpha) } }
I tried following
.addExtension( ExtensionSpec.builder(uiColorType) .addFunction( FunctionSpec.constructorBuilder() .addModifiers(Modifier.PUBLIC) .build() ) .build() )
Which yields the init function but no option to add the convenience keyword.
init
convenience
extension UIColor { public init() { } }
Hello I was wondering how following Swift code could be generated:
I tried following
Which yields the
init
function but no option to add theconvenience
keyword.