In this blitz of a doc, we're going to show you how to integrate a Flow animation into an iOS project using our Cocoapod. It's dead-easy... watch this.
If you don’t have an iOS project you’re already working on, then create one now. If you’ve already got a project, skip to the next section.
This step starts at 0:19
FlowIntegration
Flow exports solid Swift code. But, it needs a few lightweight extensions to properly integrate with UIKit. So, let’s install our cocoapod.
This step starts at 0:49
New Podfile from Xcode Project
pod 'FlowCommoniOS', '~> 1.8.4'
Now, let’s output an iOS export…
This step starts at 1:47
FlowLogoAnimation
timeline using the iOS
optionNext, you need to drag a few files into your project.
This step starts at 2:21
SceneView
and FlowLogoAnimationTimeline
into your projectimport FlowCommoniOS
to both of those filesNext, you need to add a view to your app. We’re using storyboards. If you’re using SwiftUI, or another approach, just adapt the next few steps to your needs.
This step starts at 3:10
View
to your storyboard.345 x 240
SceneView
Did the animation appear in Interface Builder?! Flow’s views are
@IBDesignable
;)
Now, let’s connect everything up.
This step starts at 4:44
ViewController
sceneView
var timeline: Timeline!
viewDidLoad
instantiate the timeline like this:
timeline = FlowLogoAnimationTimeline(view: sceneView, duration: 3.5)
viewDidAppear
trigger the animation like this:
timeline.play()
So easy.
To make an animation repeat, add a variable to the constructor.
This step starts at 6:14
repeatCount
to the timeline constructor so that it looks like this:
timeline = FlowLogoAnimationTimeline(view: sceneView, duration: 3.5, repeatCount: .greatestFiniteMagnitude)
Sooooo easy.
result(s) found for “”.