Skip to content

Commit

Permalink
Broken UIKit workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
duncandoit committed Apr 15, 2022
1 parent 0b13d67 commit ed40ee8
Show file tree
Hide file tree
Showing 16 changed files with 359 additions and 303 deletions.
4 changes: 4 additions & 0 deletions Example-iOS/RiveExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
04DB5937266A348C0020A7E8 /* RiveRuntime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04A8F6BD26452E10002C909A /* RiveRuntime.framework */; };
04DB5938266A348C0020A7E8 /* RiveRuntime.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 04A8F6BD26452E10002C909A /* RiveRuntime.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
04F1C80B26A8442300CEE6BE /* two_bone_ik.riv in Resources */ = {isa = PBXBuildFile; fileRef = 04F1C80826A8442300CEE6BE /* two_bone_ik.riv */; };
C3468E6227FDCBC6008652FD /* SimpleSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3468E6127FDCBC6008652FD /* SimpleSlider.swift */; };
C3CDFAB827E445A3005CC341 /* riveslider7.riv in Resources */ = {isa = PBXBuildFile; fileRef = C3CDFAB727E445A3005CC341 /* riveslider7.riv */; };
C9A84F38264495600014D8E0 /* RiveExplorer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A84F37264495600014D8E0 /* RiveExplorer.swift */; };
C9A84F5E2644A75A0014D8E0 /* ExamplesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C9A84F5D2644A75A0014D8E0 /* ExamplesViewController.swift */; };
Expand Down Expand Up @@ -140,6 +141,7 @@
04C4C83D2646FE410047E614 /* StateMachine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateMachine.swift; sourceTree = "<group>"; };
04D5B069266A460C004ACA5B /* nothing.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = nothing.riv; sourceTree = "<group>"; };
04F1C80826A8442300CEE6BE /* two_bone_ik.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = two_bone_ik.riv; sourceTree = "<group>"; };
C3468E6127FDCBC6008652FD /* SimpleSlider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleSlider.swift; sourceTree = "<group>"; };
C3CDFAB727E445A3005CC341 /* riveslider7.riv */ = {isa = PBXFileReference; lastKnownFileType = file; path = riveslider7.riv; sourceTree = "<group>"; };
C9A84F37264495600014D8E0 /* RiveExplorer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RiveExplorer.swift; sourceTree = "<group>"; };
C9A84F5D2644A75A0014D8E0 /* ExamplesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExamplesViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -182,6 +184,7 @@
isa = PBXGroup;
children = (
042C88872643DB7100E7DBB2 /* SimpleAnimation.swift */,
C3468E6127FDCBC6008652FD /* SimpleSlider.swift */,
042C888B2643EEE300E7DBB2 /* Layout.swift */,
042C888F2644250D00E7DBB2 /* MultipleAnimations.swift */,
C9A84F5D2644A75A0014D8E0 /* ExamplesViewController.swift */,
Expand Down Expand Up @@ -485,6 +488,7 @@
E5CD7D7127DC331900BFE5E2 /* SwiftMeshAnimation.swift in Sources */,
042C88902644250D00E7DBB2 /* MultipleAnimations.swift in Sources */,
C9E040A7264DF95C009ABC7C /* RiveSwitchBridge.swift in Sources */,
C3468E6227FDCBC6008652FD /* SimpleSlider.swift in Sources */,
04026DC827CE3EE6002B3DBF /* SwiftLayout.swift in Sources */,
04026DCC27CE3F03002B3DBF /* SwiftLoopMode.swift in Sources */,
C9A84F38264495600014D8E0 /* RiveExplorer.swift in Sources */,
Expand Down
18 changes: 9 additions & 9 deletions Example-iOS/Source/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@
<segue destination="6Y6-o9-aZy" kind="show" id="sFN-gS-xr4"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="fdr-Kk-aPS">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Y7T-yB-thu">
<rect key="frame" x="0.0" y="230.5" width="414" height="31"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="New UIKit Example"/>
<connections>
<segue destination="nXP-c2-Cpg" kind="show" id="Z2z-hZ-bi6"/>
<segue destination="nXP-c2-Cpg" kind="show" destinationCreationSelector="showUIKitSlider:" id="NDt-Ho-xN4"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SwiftUI examples" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wyj-7w-GPq">
Expand Down Expand Up @@ -150,7 +150,7 @@
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="filled" title="New SwiftUI Example"/>
<connections>
<action selector="showNewSwiftUIExample:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="bcX-1W-zmL"/>
<action selector="showSwiftUISlider:" destination="Y6W-OH-hqX" eventType="touchUpInside" id="xFo-zd-VnN"/>
</connections>
</button>
</subviews>
Expand All @@ -170,22 +170,22 @@
</objects>
<point key="canvasLocation" x="1039" y="151"/>
</scene>
<!--Rive HealthbarVC-->
<!--Simple Slider View Controller-->
<scene sceneID="Pvx-pO-5XB">
<objects>
<viewController id="nXP-c2-Cpg" customClass="RiveHealthbarVC" customModule="RiveExample" customModuleProvider="target" sceneMemberID="viewController">
<viewController id="nXP-c2-Cpg" customClass="SimpleSliderViewController" customModule="RiveExample" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2zm-EC-beS">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ds8-bv-afK" customClass="RiveView" customModule="RiveRuntime">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ds8-bv-afK" customClass="RView" customModule="RiveRuntime">
<rect key="frame" x="20" y="88" width="394" height="594"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="NxR-px-RAW">
<rect key="frame" x="18" y="782" width="378" height="31"/>
<connections>
<action selector="sliderChanged:" destination="nXP-c2-Cpg" eventType="valueChanged" id="CzE-BD-p9Z"/>
<action selector="sliderValueChanged:" destination="nXP-c2-Cpg" eventType="valueChanged" id="YV8-7f-YR1"/>
</connections>
</slider>
</subviews>
Expand All @@ -203,8 +203,8 @@
</view>
<navigationItem key="navigationItem" id="Oiz-Xf-xBD"/>
<connections>
<outlet property="riveView" destination="ds8-bv-afK" id="FQa-5M-rfP"/>
<outlet property="slider" destination="NxR-px-RAW" id="1WM-1N-uQC"/>
<outlet property="rview" destination="ds8-bv-afK" id="jOs-Qf-IUZ"/>
<outlet property="uislider" destination="NxR-px-RAW" id="BEm-CC-V0n"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="btb-K4-jol" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
Expand Down
186 changes: 95 additions & 91 deletions Example-iOS/Source/SwiftUI/Explorer/RiveExplorer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,106 +18,102 @@ struct RiveExplorer: DismissableView {
)
VStack {
HStack(alignment: .center, spacing: 50) {
if #available(iOS 14.0, *) {
Menu {
ForEach(riveController.artboardNames(), id: \.self) { name in
Button {
riveController.activeArtboard = name
} label: {
Text(name)
}
Menu {
ForEach(riveController.artboardNames(), id: \.self) { name in
Button {
riveController.activeArtboard = name
} label: {
Text(name)
}
} label: {
Text("Artboards")
Image(systemName: "square.and.pencil")
}
Menu {
ForEach(riveController.animationNames(), id: \.self) { name in
Button {
riveController.playAnimation = name
} label: {
Text(name)
}
}
} label: {
Text("Artboards")
Image(systemName: "square.and.pencil")
}
Menu {
ForEach(riveController.animationNames(), id: \.self) { name in
Button {
riveController.playAnimation = name
} label: {
Text(name)
}
} label: {
Text("Animations")
Image(systemName: "list.and.film")
}
} label: {
Text("Animations")
Image(systemName: "list.and.film")
}
}
.padding()
HStack(alignment: .center, spacing: 50) {
if #available(iOS 14.0, *) {
Menu {
Button {
riveController.fit = .fitContain
} label: {
Text("Contain")
}
Button {
riveController.fit = .fitCover
} label: {
Text("Cover")
}
Button {
riveController.fit = .fitFill
} label: {
Text("Fill")
}
Menu {
Button {
riveController.fit = .fitContain
} label: {
Text("Fit")
Image(systemName: "crop")
Text("Contain")
}
Menu {
Button {
riveController.alignment = .alignmentTopLeft
} label: {
Text("Top Left")
}
Button {
riveController.alignment = .alignmentTopCenter
} label: {
Text("Top Center")
}
Button {
riveController.alignment = .alignmentTopRight
} label: {
Text("Top Right")
}
Button {
riveController.alignment = .alignmentCenterLeft
} label: {
Text("Left")
}
Button {
riveController.alignment = .alignmentCenter
} label: {
Text("Center")
}
Button {
riveController.alignment = .alignmentCenterRight
} label: {
Text("Right")
}
Button {
riveController.alignment = .alignmentBottomLeft
} label: {
Text("Bottom Left")
}
Button {
riveController.alignment = .alignmentBottomCenter
} label: {
Text("Bottom Center")
}
Button {
riveController.alignment = .alignmentBottomRight
} label: {
Text("Bottom Right")
}
Button {
riveController.fit = .fitCover
} label: {
Text("Alignment")
Image(systemName: "square.dashed")
Text("Cover")
}
Button {
riveController.fit = .fitFill
} label: {
Text("Fill")
}
} label: {
Text("Fit")
Image(systemName: "crop")
}
Menu {
Button {
riveController.alignment = .alignmentTopLeft
} label: {
Text("Top Left")
}
Button {
riveController.alignment = .alignmentTopCenter
} label: {
Text("Top Center")
}
Button {
riveController.alignment = .alignmentTopRight
} label: {
Text("Top Right")
}
Button {
riveController.alignment = .alignmentCenterLeft
} label: {
Text("Left")
}
Button {
riveController.alignment = .alignmentCenter
} label: {
Text("Center")
}
Button {
riveController.alignment = .alignmentCenterRight
} label: {
Text("Right")
}
Button {
riveController.alignment = .alignmentBottomLeft
} label: {
Text("Bottom Left")
}
Button {
riveController.alignment = .alignmentBottomCenter
} label: {
Text("Bottom Center")
}
Button {
riveController.alignment = .alignmentBottomRight
} label: {
Text("Bottom Right")
}
} label: {
Text("Alignment")
Image(systemName: "square.dashed")
}
}
.padding()
Expand All @@ -143,10 +139,18 @@ struct RiveExplorer: DismissableView {

}
Spacer()
Button(action: dismiss, label: {
Button {

dismiss()
} label: {
Image(systemName: "x.circle")
Text("Dismiss")
})
}

// Button(action: dismiss, label: {
// Image(systemName: "x.circle")
// Text("Dismiss")
// })
}
.padding()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ extension RiveExplorerBridge {
// MARK: - Coordinator

// Coordinator between RiveView and UIRiveView
class Coordinator: NSObject, LoopDelegate, PlayDelegate, PauseDelegate, InputsDelegate {
class Coordinator: NSObject, LoopDelegate, PlayDelegate, PauseDelegate, RInputDelegate {

private var controller: RiveExplorerController
private var loopAction: LoopAction
Expand Down
22 changes: 0 additions & 22 deletions Example-iOS/Source/SwiftUI/ProgressBar/RiveProgressBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,3 @@ struct RiveProgressBar_Previews: PreviewProvider {
RiveProgressBar(resource: "energy_bar_example", controller: RiveController())
}
}

//struct NewProgressBar: View {
// private let resource = RResource(resource: "energy_bar_example", stateMachine: "State Machine ")
//
// init() {
//
// }
//
// var body: some View {
// RiveResource(resource)
// }
//
// public func setPosition() {
// setNumberState("State Machine ", inputName: "Energy", value: Float(newVal))
// }
//}
//
//extension NewRiveController {
// fileprivate func setNumberState(_ value: Float) throws {
// try oldController.setNumberState("State Machine ", inputName: "Energy", value: value)
// }
//}
8 changes: 2 additions & 6 deletions Example-iOS/Source/SwiftUI/RiveComponents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct RiveComponents: DismissableView {

VStack {
Text("New - RiveSlider")
slider.viewSwift
slider.view
}

Slider(value: Binding(get: {
Expand All @@ -58,11 +58,7 @@ struct RiveComponents: DismissableView {
value: Float(newVal)
)

try? slider.setState(
floatValue: Float(newVal),
stateMachineName: "Slide",
inputName: "FillPercent"
)
try? slider.setInput("FillPercent", value: newVal)
}), in: 0...100)
.padding()
}
Expand Down
Loading

0 comments on commit ed40ee8

Please sign in to comment.