Flow Common Files for iOS
A major goal behind our efforts here at Flow is to produce the cleanest code possible. For any platform, this means conforming to industry standards. For iOS, in particular, it means staying away from 3rd party libraries.
To make things as clean as possible, we include with every export a few files that extend the native functionality of iOS classes.
FlowCommoniOS using CocoaPods add
pod 'FlowCommoniOS' to your projects Podfile and run
pod install in your projects directory.
If you've never used CocoaPods before refer to https://guides.cocoapods.org/using/getting-started.html.
There are 6 classes that are required for running any iOS project that uses Flow timelines. A few of these are relatively small subclasses, such as
TextView. There are also a few larger classes, such as
Timeline that are critical for bringing lovely Flow functionality to your apps.
You can find all of the common files in any iOS project exported from Flow. From the XCode project navigator, you can find them in the
Animation object represents the details of a specific animation, including timing, the layer being animated, as well as methods for playback and control.
Our Animation doc is an in-depth view of this class.
Timeline object represents a set of animations associated with a view. It contains references to the main view being animated, as well as the duration, sounds, and other options such as repeat. This class is responsible for initiating and controlling the playback for all animations associated with the view.
Our Timeline doc is an in-depth view of this class.
SVGPathStringParser class is responsible for converting an SVG string into a
CGPath. It is super useful, and you can even use it on its own outside of a Flow project.
Our SVGPathStringParser doc is an in-depth view of this class.
There is also an
SVGPathStringTokenizer class that breaks down an SVG string into its component (i.e. token) elements, so that it can be accurately rebuilt as a
With these classes, parsing an SVG string is as simple as:
let string = CGPathCreateWithSVGString("M0...")
Our SVGPathStringTokenizer doc is an in-depth view of this class.
ShapeView object is a simple subclass of
UIView that includes variables for:
Our Shape View doc is an in-depth view of this class.
TextView is a simple subclass of
UILabel that exposes a
Our Text View doc is an in-depth view of this class.
Sound object contains an
AVAudioPlayer, once created it will play a sound after a specific
TimeInterval has elapsed.
Our Sound doc is an in-depth view of this class.
There are a few simple extensions to native iOS classes that are necessary for running Flow animations in an iOS project. Many of these bring a lot of power and functionality that can be used outside of Flow-related projects.
This extension defines a variable called
reversed that reverses the timing and values of a standard
Our CAKeyframeAnimation doc is an in-depth view of this extension.
This extension adds new variables and options to the standard iOS timing functions. For example, it defines a
var reversed that returns the reversed version of the current timing function.
Our CAMediaTimingFunction doc is an in-depth view of this extension.
This extension adds an incredibly handy function responsible for suppressing animations. This is super handy for anyone who uses Core Animation.
Our CATransaction doc is an in-depth view of this extension.
This extension adds a useful function for determining if a particular character is part of the current character set.
Our CharacterSet doc is an in-depth view of this extension.
This extension adds a handy initialization method for creating paragraph styles.
Our NSMutableParagraphStyle doc is an in-depth view of this extension.
This extension adds a handy initialization method for creating shadows.
Our NSShadow doc is an in-depth view of this extension.
This extension adds a convenient method for resizing images.
Our UIImage doc is an in-depth view of this extension.
This extension adds a convenient method for setting the
transform property on a view.
Our UIView doc is an in-depth view of this extension.