Generates a UIBezierPath approximation of an arithmetic spiral. Swift version of https://github.com/ZevEisenberg/ZESpiral
This is a swift conversion of ZESpiral which is used to generate arithmetic (“Archimedes”) spirals. It uses Bézier curve approximation to create a UIBezierPath of the form r = a + bθ.
Simply drag and drop the extension in your project.
Since the extension is implemented in Swift, if you are using Objective-C, you need to go to your target Build Settings and change Define Module
to Yes
. You can also choose a Product Module Name. Finally, import the module in your .m
file:
#import "YourProductModuleName-Swift.h"
let center = self.center
let startRad: CGFloat = 0
let space: CGFloat = 5
let starttheta: CGFloat = 0
let endtheta: CGFloat = 30
let thetastep: CGFloat = 1
YourLayer.path = UIBezierPath.getSpiralPath(center: center, startRadius: startRad, spacePerLoop: space, startTheta: starttheta, endTheta: endtheta, thetaStep: thetastep).cgPath