-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added robust play method (#41)
- Loading branch information
Showing
5 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
enum RNDirection: String { | ||
case Backwards = "backwards" | ||
case Auto = "auto" | ||
case Forwards = "forwards" | ||
|
||
static func mapToRNDirection(value: String) -> RNDirection { | ||
if let rnEnum = RNDirection(rawValue: value) { | ||
return rnEnum | ||
} else { | ||
fatalError("Unsupported direction type: \(value)") | ||
} | ||
} | ||
|
||
static func mapToRiveDirection(rnDirection: RNDirection) -> Direction { | ||
switch rnDirection { | ||
case .Backwards: | ||
return .directionBackwards | ||
case .Auto: | ||
return .directionAuto | ||
case .Forwards: | ||
return .directionForwards | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
enum RNLoopMode: String { | ||
case OneShot = "oneShot" | ||
case Loop = "loop" | ||
case PingPong = "pingPong" | ||
case Auto = "none" | ||
|
||
static func mapToRNLoopMode(value: String) -> RNLoopMode { | ||
if let rnEnum = RNLoopMode(rawValue: value) { | ||
return rnEnum | ||
} else { | ||
fatalError("Unsupported loop mode type: \(value)") | ||
} | ||
} | ||
|
||
static func mapToRiveLoop(rnLoopMode: RNLoopMode) -> Loop{ | ||
switch rnLoopMode { | ||
case .OneShot: | ||
return .loopOneShot | ||
case .Loop: | ||
return .loopLoop | ||
case .PingPong: | ||
return .loopPingPong | ||
case .Auto: | ||
return .loopAuto | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters