Gave RiveViewModel specialized inits so that users are presented without only an animation or a state machine param

This commit is contained in:
Zachary Duncan
2022-06-08 00:09:42 -04:00
committed by Zachary Duncan
parent a4387fc273
commit 79f31196f3
6 changed files with 66 additions and 27 deletions

View File

@@ -18,10 +18,10 @@ class MultipleAnimationsController: UIViewController {
@IBOutlet weak var rviewStar: RiveView!
var rSquareGoAround = RiveViewModel(
fileName: "artboard_animations", artboardName: "Square", animationName: "goaround"
fileName: "artboard_animations", animationName: "goaround", artboardName: "Square"
)
var rSquareRollAround = RiveViewModel(
fileName: "artboard_animations", artboardName: "Square", animationName: "rollaround"
fileName: "artboard_animations", animationName: "rollaround", artboardName: "Square"
)
var rCircle = RiveViewModel(
fileName: "artboard_animations", artboardName: "Circle"

View File

@@ -19,11 +19,11 @@ struct SwiftMultipleAnimations: DismissableView {
ScrollView{
VStack {
Text("Square - go around")
RiveViewModel(model(), artboardName: "Square", animationName: "goaround").view()
RiveViewModel(model(), animationName: "goaround", artboardName: "Square").view()
.aspectRatio(1, contentMode: .fit)
Text("Square - roll around")
RiveViewModel(model(), artboardName: "Square", animationName: "rollaround").view()
RiveViewModel(model(), animationName: "rollaround", artboardName: "Square").view()
.aspectRatio(1, contentMode: .fit)
Text("Circle")

View File

@@ -17,7 +17,7 @@ struct SwiftTestParityAnimSM: DismissableView {
SwiftVMPlayer(
viewModels:
RiveViewModel(fileName: "teststatemachine", stateMachineName: "State Machine 1", autoPlay: false),
RiveViewModel(fileName: "testanimation", autoPlay: false, animationName: "Move")
RiveViewModel(fileName: "testanimation", animationName: "Move", autoPlay: false)
)
}
}

View File

@@ -24,7 +24,7 @@ class RiveSwitch: RiveViewModel {
}
init() {
super.init(fileName: "switch", fit: .fitCover, animationName: startAnimation)
super.init(fileName: "switch", animationName: startAnimation, fit: .fitCover)
}
func view(_ action: ((Bool) -> Void)? = nil) -> some View {