fix(apple): resolve Preview (iOS) scheme build errors (#9818) 5007acb498

Co-authored-by: David Skuza <david@rive.app>
This commit is contained in:
dskuza
2025-06-04 14:50:39 +00:00
parent eab76098eb
commit 7317f695fb
5 changed files with 40 additions and 33 deletions

View File

@@ -1 +1 @@
aca08e662cd3fdf853e82105373c8a595cb4dbea 5007acb4982b7f1959e8d6bb688ddd9546936655

View File

@@ -32,9 +32,11 @@ git submodule update --init --recursive
Once you have cloned the repository, the prerequisites are installed, and your Xcode active developer directory is properly set, you can build this runtime by running the following from the **root** of your cloned repository: Once you have cloned the repository, the prerequisites are installed, and your Xcode active developer directory is properly set, you can build this runtime by running the following from the **root** of your cloned repository:
```bash ```bash
$ ./scripts/build.sh all release $ PATH=./submodules/rive-runtime/:$PATH ./scripts/build.sh all release
``` ```
Note: `PATH` must be updated for the Apple runtime build scripts to find `build_rive.sh`. The above command will temporarily set `PATH` to include the appropriate directory while the script is running.
If the script completes successfully, then all necessary frameworks are built, and you can continue on to running the Example apps. If the script completes successfully, then all necessary frameworks are built, and you can continue on to running the Example apps.
## Example and Preview targets / schemes ## Example and Preview targets / schemes

View File

@@ -331,6 +331,7 @@
F22CF1AD2D380E1400D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; }; F22CF1AD2D380E1400D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; };
F22CF1AE2D380E1500D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; }; F22CF1AE2D380E1500D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; };
F22CF1AF2D380E1600D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; }; F22CF1AF2D380E1600D35779 /* data_binding_test.riv in Resources */ = {isa = PBXBuildFile; fileRef = F22CF1A92D36BFFF00D35779 /* data_binding_test.riv */; };
F23A50602DE60E4600366506 /* DataBindingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F259E5822D35B7FA00B78FEF /* DataBindingView.swift */; };
F259E5832D35B7FA00B78FEF /* DataBindingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F259E5822D35B7FA00B78FEF /* DataBindingView.swift */; }; F259E5832D35B7FA00B78FEF /* DataBindingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F259E5822D35B7FA00B78FEF /* DataBindingView.swift */; };
F26E20AC2CF0E21000130111 /* streaming.riv in Resources */ = {isa = PBXBuildFile; fileRef = F26E20A92CF0E21000130111 /* streaming.riv */; }; F26E20AC2CF0E21000130111 /* streaming.riv in Resources */ = {isa = PBXBuildFile; fileRef = F26E20A92CF0E21000130111 /* streaming.riv */; };
F2AB95D12CF0EB800055376E /* streaming.riv in Resources */ = {isa = PBXBuildFile; fileRef = F26E20A92CF0E21000130111 /* streaming.riv */; }; F2AB95D12CF0EB800055376E /* streaming.riv in Resources */ = {isa = PBXBuildFile; fileRef = F26E20A92CF0E21000130111 /* streaming.riv */; };
@@ -344,10 +345,6 @@
F2C291622DB6D571009A2918 /* rewards.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C2915C2DB6D571009A2918 /* rewards.riv */; }; F2C291622DB6D571009A2918 /* rewards.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C2915C2DB6D571009A2918 /* rewards.riv */; };
F2C291662DB6D599009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; }; F2C291662DB6D599009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C291672DB6D599009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; }; F2C291672DB6D599009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C291682DB6D5A6009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C291692DB6D5A6009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C2916A2DB6D5A6009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C2916B2DB6D5A6009A2918 /* RewardsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C291652DB6D599009A2918 /* RewardsView.swift */; };
F2C623362C874E3A0006E0CA /* fallback_fonts.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C623352C874E3A0006E0CA /* fallback_fonts.riv */; }; F2C623362C874E3A0006E0CA /* fallback_fonts.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C623352C874E3A0006E0CA /* fallback_fonts.riv */; };
F2C623372C874E3A0006E0CA /* fallback_fonts.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C623352C874E3A0006E0CA /* fallback_fonts.riv */; }; F2C623372C874E3A0006E0CA /* fallback_fonts.riv in Resources */ = {isa = PBXBuildFile; fileRef = F2C623352C874E3A0006E0CA /* fallback_fonts.riv */; };
F2C623392C874E690006E0CA /* SwiftFallbackFonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C623382C874E690006E0CA /* SwiftFallbackFonts.swift */; }; F2C623392C874E690006E0CA /* SwiftFallbackFonts.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2C623382C874E690006E0CA /* SwiftFallbackFonts.swift */; };
@@ -1391,7 +1388,6 @@
040553842B7A274B008F076A /* ContentView.swift in Sources */, 040553842B7A274B008F076A /* ContentView.swift in Sources */,
040553852B7A274B008F076A /* SwiftEvents.swift in Sources */, 040553852B7A274B008F076A /* SwiftEvents.swift in Sources */,
040553862B7A274B008F076A /* Example__macOS_App.swift in Sources */, 040553862B7A274B008F076A /* Example__macOS_App.swift in Sources */,
F2C291682DB6D5A6009A2918 /* RewardsView.swift in Sources */,
040553882B7A274B008F076A /* DismissableView.swift in Sources */, 040553882B7A274B008F076A /* DismissableView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -1422,6 +1418,7 @@
040553E42B7A2858008F076A /* SwiftLayout.swift in Sources */, 040553E42B7A2858008F076A /* SwiftLayout.swift in Sources */,
040553E52B7A2858008F076A /* SceneDelegate.swift in Sources */, 040553E52B7A2858008F076A /* SceneDelegate.swift in Sources */,
040553E62B7A2858008F076A /* SwiftEvents.swift in Sources */, 040553E62B7A2858008F076A /* SwiftEvents.swift in Sources */,
F23A50602DE60E4600366506 /* DataBindingView.swift in Sources */,
040553E72B7A2858008F076A /* StateMachine.swift in Sources */, 040553E72B7A2858008F076A /* StateMachine.swift in Sources */,
F2C291662DB6D599009A2918 /* RewardsView.swift in Sources */, F2C291662DB6D599009A2918 /* RewardsView.swift in Sources */,
040553E82B7A2858008F076A /* RiveSlider.swift in Sources */, 040553E82B7A2858008F076A /* RiveSlider.swift in Sources */,
@@ -1446,7 +1443,6 @@
04E51C382A151A1E0075E473 /* ContentView.swift in Sources */, 04E51C382A151A1E0075E473 /* ContentView.swift in Sources */,
E5964AAC2A9CD49200140479 /* SwiftEvents.swift in Sources */, E5964AAC2A9CD49200140479 /* SwiftEvents.swift in Sources */,
04E51C362A151A1E0075E473 /* Example__macOS_App.swift in Sources */, 04E51C362A151A1E0075E473 /* Example__macOS_App.swift in Sources */,
F2C291692DB6D5A6009A2918 /* RewardsView.swift in Sources */,
F8DA7B462AF523A800FF3CBF /* DismissableView.swift in Sources */, F8DA7B462AF523A800FF3CBF /* DismissableView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
@@ -1501,7 +1497,6 @@
files = ( files = (
F22138812CCBEDD400A25BA7 /* ContentView.swift in Sources */, F22138812CCBEDD400A25BA7 /* ContentView.swift in Sources */,
F221387F2CCBEDD400A25BA7 /* Example__visionOS_App.swift in Sources */, F221387F2CCBEDD400A25BA7 /* Example__visionOS_App.swift in Sources */,
F2C2916A2DB6D5A6009A2918 /* RewardsView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@@ -1511,7 +1506,6 @@
files = ( files = (
F2C852D62CD1772300F0D81F /* ContentView.swift in Sources */, F2C852D62CD1772300F0D81F /* ContentView.swift in Sources */,
F2C852D42CD1772300F0D81F /* Example__tvOS_App.swift in Sources */, F2C852D42CD1772300F0D81F /* Example__tvOS_App.swift in Sources */,
F2C2916B2DB6D5A6009A2918 /* RewardsView.swift in Sources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View File

@@ -118,7 +118,7 @@ struct RewardsSettingsView: View {
var body: some View { var body: some View {
Form { Form {
Section("Reward") { Section {
Picker("Type", selection: $viewModel.rewardType) { Picker("Type", selection: $viewModel.rewardType) {
Text("Coin").tag(RewardsViewModel.RewardType.coin) Text("Coin").tag(RewardsViewModel.RewardType.coin)
Text("Gem").tag(RewardsViewModel.RewardType.gem) Text("Gem").tag(RewardsViewModel.RewardType.gem)
@@ -138,20 +138,24 @@ struct RewardsSettingsView: View {
Text("Price") Text("Price")
TextField("Price", value: $viewModel.price, formatter: NumberFormatter()).multilineTextAlignment(.trailing) TextField("Price", value: $viewModel.price, formatter: NumberFormatter()).multilineTextAlignment(.trailing)
} }
} header: {
Text("Reward")
} }
Section("Button") { Section {
HStack { HStack {
Text("Initial Text") Text("Initial Text")
TextField("Initial Text", text: $viewModel.initialButtonText).multilineTextAlignment(.trailing) TextField("Initial Text", text: $viewModel.initialButtonText).multilineTextAlignment(.trailing)
} }
} header: {
Text("Reward")
} }
Section { Section {
Button(role: .destructive) { Button {
viewModel.reset() viewModel.reset()
} label: { } label: {
Text("Reset") Text("Reset").foregroundColor(.red)
} }
} }
} }
@@ -181,12 +185,16 @@ struct RewardsView: DismissableView {
if #available(iOS 16, *) { if #available(iOS 16, *) {
RewardsSettingsView(viewModel: rewardsViewModel) RewardsSettingsView(viewModel: rewardsViewModel)
.presentationDetents([.medium]) .presentationDetents([.medium])
} else {
RewardsSettingsView(viewModel: rewardsViewModel)
} }
} }
.alert("Congratulations!", isPresented: $rewardsViewModel.isPresentingAlert) { .alert(isPresented: $rewardsViewModel.isPresentingAlert) {
Button("Okay") { } Alert(
} message: { title: Text("Congratulations"),
Text(rewardsViewModel.alertMessage) message: Text(rewardsViewModel.alertMessage),
dismissButton: .default(Text("Okay"))
)
} }
} }
} }

View File

@@ -27,34 +27,37 @@ The library is distributed both through Swift Package Manager and Cocoapods.
:house_with_garden: [Homepage](https://rive.app/) :house_with_garden: [Homepage](https://rive.app/)
:blue_book: [Rive docs](https://rive.app/community/doc/) :blue_book: [Rive docs](https://rive.app/docs/)
🛠 [Rive Forums](https://community.rive.app/) 🛠 [Rive Community](https://community.rive.app/)
## Getting started ## Getting started
To get started with Rive iOS, check out the following resources: To get started with Rive Apple runtime, check out the following resources:
- [Getting Started with Rive iOS](https://rive.app/community/doc/iosmacos/docXbeEcWybL) - [Getting Started with the Rive Apple runtime](https://rive.app/docs/runtimes/apple/apple)
For more information, see the Runtime sections of the Rive help documentation: For more information, see the Runtime sections of the Rive help documentation:
- [Animation Playback](https://rive.app/community/doc/animation-playback/docDKKxsr7ko) - [Animation Playback](https://rive.app/docs/runtimes/animation-playback)
- [Layout](https://rive.app/community/doc/layout/docBl81zd1GB) - [Layout](https://rive.app/docs/runtimes/layout)
- [State Machines](https://rive.app/community/doc/state-machines/docxeznG7iiK) - [State Machines](https://rive.app/docs/runtimes/state-machines)
- [Rive Text](https://rive.app/community/doc/text/docn2E6y1lXo) - [Rive Text](https://rive.app/docs/runtimes/text)
- [Rive Events](https://rive.app/community/doc/rive-events/docbOnaeffgr) - [Rive Events](https://rive.app/docs/runtimes/rive-events)
- [Loading Assets](https://rive.app/community/doc/loading-assets/doct4wVHGPgC) - [Loading Assets](https://rive.app/docs/runtimes/loading-assets)
- [Data Binding](https://rive.app/docs/runtimes/data-binding)
## Supported devices ## Supported platforms
Currently, this runtime library supports a minimum iOS version of **14.0+**. Devices supported include iPhone, iPad, and Mac catalyst. macOS support supports a targeted version of **13.1**. Supported platforms include iOS, macOS, tvOS, and visionOS. For the minimum supported versions, see [Package.swift](./Package.swift).
## Examples ## Examples
Check out the `Example-iOS/` folder for an example application using the Rive iOS/macOS runtime. Check out the `Example-iOS/` folder for code examples on how to use the Rive Apple runtime.
Open the project in XCode and ensure the selected scheme/target is set to `Preview`/`Preview (macOS)`. These schemes make use of the hosted Rive package dependency. The other targets are for local development and require additional configuration and set-up. See [Customizing the build schemes for a project](https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project) for instructions to switch schemes, and `CONTRIBUTING.md` for more information. Open `RiveRuntime.xcworkspace` in Xcode and ensure the selected scheme is set to `Preview (iOS)` or `Preview (macOS)`, based on what platform you want to preview. These schemes make use of the Swift Package Manager package of the Rive Apple runtime, and are the schemes you should use to preview the Rive examples.
**Note**: The other targets are for local development and require additional configuration and set-up. See [Customizing the build schemes for a project](https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project) for instructions to switch schemes, and [CONTRIBUTING.md](./CONTRIBUTING.md) for more information. You should not use these schemes unless you are making changes to the underlying C++ runtime.
The example showcases a number of ways to use the high-level `RiveViewModel` API through UIKit and SwiftUI examples, including: The example showcases a number of ways to use the high-level `RiveViewModel` API through UIKit and SwiftUI examples, including:
@@ -72,7 +75,7 @@ For even more examples and resources on using Rive at runtime or in other tools,
Using an older version of the runtime and need to learn how to upgrade to the latest version? Check out the migration guides below in our help center that help guide you through version bumps; breaking changes and all! Using an older version of the runtime and need to learn how to upgrade to the latest version? Check out the migration guides below in our help center that help guide you through version bumps; breaking changes and all!
[Migration guides](https://rive.app/community/doc/migrating-from-5xx-to-6xx/doczu7i8HFcV) [Migration Guides](https://rive.app/docs/runtimes/apple/migrating-from-5.x.x-to-6.x.x)
## Contributing ## Contributing