Skip to content

Commit

Permalink
Add a mesh example and add missing energy_bar_asset
Browse files Browse the repository at this point in the history
  • Loading branch information
zplata committed Mar 16, 2022
1 parent a0eb22b commit 6851222
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 7 deletions.
Binary file added Example-iOS/Assets/energy_bar_example.riv
Binary file not shown.
Binary file added Example-iOS/Assets/prop_example.riv
Binary file not shown.
15 changes: 12 additions & 3 deletions Example-iOS/RiveExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
C9E0409F264DF1A3009ABC7C /* RiveSwitch.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E0409E264DF1A3009ABC7C /* RiveSwitch.swift */; };
C9E040A7264DF95C009ABC7C /* RiveSwitchBridge.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9E040A6264DF95C009ABC7C /* RiveSwitchBridge.swift */; };
C9E040A9264DFCFD009ABC7C /* switch.riv in Resources */ = {isa = PBXBuildFile; fileRef = C9E040A8264DFCFD009ABC7C /* switch.riv */; };
E5CD7D6827DBF4D500BFE5E2 /* energy_bar_example.riv in Resources */ = {isa = PBXBuildFile; fileRef = E5CD7D6527DBF4D500BFE5E2 /* energy_bar_example.riv */; };
E5A7874A27E115170056F24B /* energy_bar_example.riv in Resources */ = {isa = PBXBuildFile; fileRef = E5A7874727E115170056F24B /* energy_bar_example.riv */; };
E5A7874C27E1158E0056F24B /* prop_example.riv in Resources */ = {isa = PBXBuildFile; fileRef = E5A7874B27E1158E0056F24B /* prop_example.riv */; };
E5CD7D7127DC331900BFE5E2 /* SwiftMeshAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = E5CD7D7027DC331900BFE5E2 /* SwiftMeshAnimation.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -157,7 +159,9 @@
C9E0409E264DF1A3009ABC7C /* RiveSwitch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RiveSwitch.swift; sourceTree = "<group>"; };
C9E040A6264DF95C009ABC7C /* RiveSwitchBridge.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RiveSwitchBridge.swift; sourceTree = "<group>"; };
C9E040A8264DFCFD009ABC7C /* switch.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = switch.riv; sourceTree = "<group>"; };
E5CD7D6527DBF4D500BFE5E2 /* energy_bar_example.riv */ = {isa = PBXFileReference; lastKnownFileType = file; name = energy_bar_example.riv; path = ../../../../../Downloads/energy_bar_example.riv; sourceTree = "<group>"; };
E5A7874727E115170056F24B /* energy_bar_example.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = energy_bar_example.riv; sourceTree = "<group>"; };
E5A7874B27E1158E0056F24B /* prop_example.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = prop_example.riv; sourceTree = "<group>"; };
E5CD7D7027DC331900BFE5E2 /* SwiftMeshAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftMeshAnimation.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -219,7 +223,9 @@
042C88D12644447500E7DBB2 /* flux_capacitor.riv */,
C9CE8265263B90E000F98DDB /* juice_v7.riv */,
C9D3DE67264F49F4001BA265 /* life_bar.riv */,
E5A7874B27E1158E0056F24B /* prop_example.riv */,
04F1C80826A8442300CEE6BE /* two_bone_ik.riv */,
E5A7874727E115170056F24B /* energy_bar_example.riv */,
C9D3DE5A264F3B51001BA265 /* liquid.riv */,
042C88D62644447500E7DBB2 /* loopy.riv */,
042C88CD2644447400E7DBB2 /* mascot.riv */,
Expand Down Expand Up @@ -253,6 +259,7 @@
04026DC927CE3EF6002B3DBF /* SwiftMultipleAnimations.swift */,
04026DCB27CE3F03002B3DBF /* SwiftLoopMode.swift */,
04026DCD27CE3F0F002B3DBF /* SwiftStateMachine.swift */,
E5CD7D7027DC331900BFE5E2 /* SwiftMeshAnimation.swift */,
);
path = SwiftUI;
sourceTree = "<group>";
Expand Down Expand Up @@ -454,8 +461,9 @@
0450446126B3F71E007B25CA /* constrained.riv in Resources */,
C9D3DE68264F49F4001BA265 /* life_bar.riv in Resources */,
042C88DB2644447500E7DBB2 /* wacky.riv in Resources */,
E5CD7D6827DBF4D500BFE5E2 /* energy_bar_example.riv in Resources */,
E5A7874A27E115170056F24B /* energy_bar_example.riv in Resources */,
042C88EB2644447500E7DBB2 /* clipping.riv in Resources */,
E5A7874C27E1158E0056F24B /* prop_example.riv in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -471,6 +479,7 @@
042C888E2644230700E7DBB2 /* utility.swift in Sources */,
C9E0409F264DF1A3009ABC7C /* RiveSwitch.swift in Sources */,
C9D3DE5E264F3B72001BA265 /* RiveProgressBar.swift in Sources */,
E5CD7D7127DC331900BFE5E2 /* SwiftMeshAnimation.swift in Sources */,
042C88902644250D00E7DBB2 /* MultipleAnimations.swift in Sources */,
C9E040A7264DF95C009ABC7C /* RiveSwitchBridge.swift in Sources */,
04026DC827CE3EE6002B3DBF /* SwiftLayout.swift in Sources */,
Expand Down
11 changes: 9 additions & 2 deletions Example-iOS/Source/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="wRo-9V-rXR">
<rect key="frame" x="0.0" y="88" width="414" height="461"/>
<rect key="frame" x="0.0" y="88" width="414" height="491"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="UIKit examples" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="C8u-cc-gX1">
<rect key="frame" x="0.0" y="0.0" width="414" height="20.5"/>
Expand Down Expand Up @@ -130,6 +130,13 @@
<segue destination="uUT-OA-tcC" kind="show" destinationCreationSelector="showStateMachine:" id="vXr-uV-fEd"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="MRR-U0-Wdr">
<rect key="frame" x="0.0" y="461" width="414" height="30"/>
<state key="normal" title="Mesh Example"/>
<connections>
<segue destination="uUT-OA-tcC" kind="show" destinationCreationSelector="showMeshExample:" id="vR2-MY-ezJ"/>
</connections>
</button>
</subviews>
</stackView>
</subviews>
Expand Down Expand Up @@ -978,7 +985,7 @@
</scene>
</scenes>
<inferredMetricsTieBreakers>
<segue reference="vXr-uV-fEd"/>
<segue reference="vR2-MY-ezJ"/>
</inferredMetricsTieBreakers>
<resources>
<systemColor name="systemBackgroundColor">
Expand Down
28 changes: 28 additions & 0 deletions Example-iOS/Source/SwiftUI/SwiftMeshAnimation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// SwiftMeshAnimation.swift
// RiveExample
//
// Created by Zach Plata on 3/11/22.
// Copyright © 2022 Rive. All rights reserved.
//

import SwiftUI
import RiveRuntime

struct SwiftMeshAnimation: View {
let controller = RiveController();
@State var isTapped: Bool = false

var body: some View {
RiveViewSwift(
resource: "prop_example",
stateMachine: "State Machine 1",
controller: controller
).frame(height:200)
.onTapGesture {
isTapped = !isTapped
try? self.controller.setBooleanState("State Machine 1", inputName: "Hover", value: isTapped)
}

}
}
14 changes: 14 additions & 0 deletions Example-iOS/Source/UIkit/ExamplesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,20 @@ class ExamplesViewController: UIViewController {
@IBSegueAction func showStateMachine(_ coder: NSCoder) -> UIViewController? {
return StateMachineHostingController(coder: coder)
}

@IBSegueAction func showMeshExample(_ coder: NSCoder) -> UIViewController? {
return MeshExampleHostingController(coder: coder)
}
}

class MeshExampleHostingController: UIHostingController<SwiftMeshAnimation> {
required init?(coder: NSCoder) {
super.init(coder: coder, rootView: SwiftMeshAnimation())
}

func dismiss() {
dismiss(animated: true, completion: nil)
}
}


Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ 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.
Expand Down
2 changes: 1 addition & 1 deletion RiveRuntime.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@
C9C73EC824FC478800EF9516 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1310;
LastUpgradeCheck = 1320;
ORGANIZATIONNAME = Rive;
TargetAttributes = {
C9C73ED024FC478800EF9516 = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1310"
LastUpgradeVersion = "1320"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down

0 comments on commit 6851222

Please sign in to comment.