Here's an example code for a circular progress view:
main.swift1024 chars36 lines
This code creates a UIView
subclass named CircleProgressView
that contains a CAShapeLayer
that draws a circle. The animate(to:)
function takes a progress between 0.0 to 1.0 and animates the stroke of the circle accordingly.
To use this view, simply add it to your view hierarchy and call animate(to:)
to update the progress. For example:
main.swift184 chars5 lines
gistlibby LogSnag