mirror of
https://github.com/rive-app/rive-ios.git
synced 2026-01-18 17:11:28 +01:00
Gave RiveViewModel specialized inits so that users are presented without only an animation or a state machine param
This commit is contained in:
committed by
Zachary Duncan
parent
a4387fc273
commit
79f31196f3
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user