Skip to content

Commit

Permalink
Bump major version to 3.0.0 and updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
duncandoit committed Jul 7, 2022
1 parent 5c44226 commit 6831739
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
68 changes: 37 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ This is the iOS runtime for [Rive](https://rive.app), currently in beta. The api
as we continue to improve it. Please file issues and PRs for anything busted, missing, or just wrong.

# Installing rive-ios
## Via Swift Package Manager
To install via Swift Package Manager, in the package finder in xcode, search with the Github repository name: `https://github.com/rive-app/rive-ios`

Once you have installed the package, you can run

```swift
import RiveRuntime
```

## Via Cocoapods
To install our pod, simply add the following to [cocoapods](https://cocoapods.org/) and run `pod install`.

Expand All @@ -32,13 +41,10 @@ import RiveRuntime

to have access to our higher level views or build on top of our bindings to control your own animation loop.

## Via Swift Package Manager
To install via Swift Package Manager, in the package finder in xcode, search with the Github repository name: `https://github.com/rive-app/rive-ios`

# Examples
There is an example project next to the runtimes.
There is an demo project in a folder called Demo-App that shows how simple it is to display beautiful animations with very few lines of code.

The examples show simple ways of adding animated views into your app, how to add buttons & slider controls, how
There is also a more in-depth example project that show many ways of adding animated views into your app, how to add buttons & slider controls, how
to use state machines & how to navigate the contents of a rive file programatically.

To run the example, open the `Rive.xcworkspace` in Xcode and run the `RiveExample` project. Check out the
Expand Down Expand Up @@ -105,27 +111,27 @@ The Rive view can be further customized as part of specifying layout attributes.

`fit` can be specified to determine how the animation should be resized to fit its container. The available
choices are:
- `.fitFill`
- `.fitContain`
- `.fitCover`
- `.fitFitWidth`
- `.fitFitHeight`
- `.fitNone`
- `.fitScaleDown`
- `.fill`
- `.contain`
- `.cover`
- `.fitWidth`
- `.fitHeight`
- `.scaleDown`
- `.noFit`

`alignment` informs how it should be aligned within the container. The available choices are:
- `alignmentTopLeft`
- `alignmentTopCenter`
- `alignmentTopRight`
- `alignmentCenterLeft`
- `alignmentCenter`
- `alignmentCenterRight`
- `alignmentBottomLeft`
- `alignmentBottomCenter`
- `alignmentBottomRight`
- `topLeft`
- `topCenter`
- `topRight`
- `centerLeft`
- `center`
- `centerRight`
- `bottomLeft`
- `bottomCenter`
- `bottomRight`

By default, if no `fit` or `alignment` properties are set on the `RiveViewModel`, the view will be set
with `.fitContain` and `.alignmentCenter`.
with `.contain` and `.center`.

To understand more on these options, check out the help docs [here](https://help.rive.app/runtimes/layout#fit).

Expand All @@ -134,16 +140,16 @@ To add layout options, you can set it below like:
```swift
let viewModel = RiveViewModel(
fileName: "truck_v7",
fit: .fitFill,
alignment: .alignmentBottomLeft
fit: .fill,
alignment: .bottomLeft
)
```

or anytime afterwards.

```swift
viewModel.fit = .fitCover
viewModel.alignment = .alignmentCenter
viewModel.fit = .cover
viewModel.alignment = .center
```

### Playback Controls
Expand All @@ -155,8 +161,8 @@ are multiple artboards and/or animations defined in the Rive file.
let viewModel = RiveViewModel(
riveFile: "artboard_animations",
animationName: "rollaround",
fit: .fitContain,
alignment: .alignmentCenter,
fit: .contain,
alignment: .center,
autoplay: true,
artboardName: "Square"
)
Expand All @@ -175,8 +181,8 @@ When playing animations, the loop mode and direction of the animations can also
```swift
viewModel.play(
animationName: "rollaround",
loop: .loopOneShot,
direction: .directionBackwards
loop: .oneShot,
direction: .backwards
)
```

Expand Down Expand Up @@ -234,7 +240,7 @@ class FancyViewModel: RiveViewModel {
Then you would instantiate your view model and configure it with the `RiveView` as you normally would:

```swift
class SimpleAnimationViewController: UIViewController {
class FancyAnimationViewController: UIViewController {
@IBOutlet weak var riveView: RiveView!
var fancyVM = FancyViewModel()

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.29
3.0.0

0 comments on commit 6831739

Please sign in to comment.