-
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 ios simple example (#27)
* feat: updated pod source and added example file * feat: added simple ios example
- Loading branch information
Showing
12 changed files
with
230 additions
and
175 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
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
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
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 was deleted.
Oops, something went wrong.
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,47 @@ | ||
import UIKit | ||
import RiveRuntime | ||
|
||
class RiveReactNativeView: UIView { | ||
@objc var resourceName: String? | ||
let riveView = RiveView() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
riveView.frame = frame | ||
riveView.configure(getRiveFile(resourceName: "truck_v7"), andAutoPlay: false) | ||
addSubview(riveView) | ||
} | ||
|
||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
for view in subviews { | ||
view.reactSetFrame(self.bounds) | ||
} | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
@objc func play() { | ||
riveView.play() | ||
} | ||
|
||
|
||
// func updateArtboard(_ artboard: RiveArtboard) { | ||
// self.artboard = artboard; | ||
// } | ||
|
||
// override func draw(_ rect: CGRect) { | ||
// guard let context = UIGraphicsGetCurrentContext(), let artboard = self.artboard else { | ||
// return | ||
// } | ||
// let renderer = RiveRenderer(context: context); | ||
// renderer.align(with: rect, withContentRect: artboard.bounds(), with: Alignment.Center, with: Fit.Contain) | ||
// artboard.draw(renderer) | ||
// } | ||
|
||
} | ||
|
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
Oops, something went wrong.