Hello Flex Team!
My initial approach was to create this timer with an eye towards an MVVM architecture. This could pretty simply be done in SwiftUI, but since SwiftUI has a deployment target of iOS 13 I thought it might be nicer to include users
from earlier OS' & devices. This project has three major components:
FlexTimer, our own rolled timer functionally similar toTimer(aka,NSTimer) which leveragesRunLoopsbut gives us more control over pausing, starting, stopping, incremental callouts and completion callouts.QuartzCore, usingCAShapeLayersto draw our paths,CABasicAnimationsto interpolate between keyframe states,CAMediaTimingto allow for pause/resume a layer's animations. This is preferable to using onlydrawRectand maintaining animation and interpolation between values and states.UIKit, usingUIViewas a parent class, we're able to bind together our color selection, gesture recognizers, quartz layers, timing duration & timer-states/animation-states.
I've always been a fan of community components that have very little runway or user configuration and that was the intent here.
This FlexTimerView only needs to be added to a superview to immediately function and provides an optional onChange callback for external objects to respond to.
Please view the /docs folder with a browser to see our docs generated by jazzy using:
Ref: https://github.com/realm/jazzy
$ jazzy \
--clean \
--author "Miles Alden" \
--github_url https://github.com/Fritoo/FlexTimer \
--output docs/ \
--min-acl internal