-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add visionOS and tvOS support to Apple runtime
This pull request adds support for both visionOS and tvOS to the Apple (colloquially referred to as iOS) runtime. It should _not_ be a breaking change, since the only major API change is an internal one (see `RenderContext` below). I believe we should be able to make this a minor release. Developers who have subclassed `RiveView` or `RiveRendererView` should not see any changes, unless they were explicitly expecting this view to be `MTKView`, which is fully unavailable on visionOS (hence our recreation - see `RiveMTKView` below. ## Premake Scripts The premake scripts were updated to add a few new variants for iOS: - xros (visionOS devices; named after the internal sdk) - xrsimulator (visionOS simulator; named after the internal sdk) - appletvos (tvOS devices; named after the internal sdk) - appletvsimulator (tvOS simulators; named after the internal sdk) The majority of the work here is copy/pasting existing code, and just adding additional filters when these new options are used, primarily used to target the new SDKs / minimums for those SDKs. ## Shaders Shaders are pre-compiled for visionOS and tvOS separately, and the correct shaders are then used later-on at compile time. ## Build scripts Build scripts were updated to support building the new libraries, targeting the new devices, using the new options above. Additionally, they have to point to new output files. The `build_framework` script has been updated to build the new libraries to add to the final output `xcframework`. ## Project Example targets for both visionOS and tvOS, since these truly are the "native" apps, rather than just iPad-on-your-device. These use a new `streaming` riv by the creative team. The tvOS example app adds additional support for remote control, since that behavior can be utilized in multiple ways during development; that is, we don't add any "default" behavior for remote controls. The visionOS app, on the other hand, works out-of-the-box with no additional changes. ## RenderContext `RenderContext` is an internal type; it's forward-declared, so it's unusable outside of the scope of internal development. There have been some "breaking" changes here - the API has been updated to, instead of passing in `MTKView` around, using `id<RiveMetalDrawableView>`. This had to be changed, regardless, since visionOS does not have `MTKView`. The choice to use a protocol was because it forces a little more explicit initialization across platforms, rather than having a parent class that acts as an abstract class, but isn't abstract because it still needs some default values, but those values are different based on device and API availability, etc. We could've passed around `RiveMTKView` as the type, but with a protocol, there's a possibility of being able to use a type that isn't exactly a view, but might want to still act against the drawing process. Personal choice, really. ## RiveRendererView `RiveRendererView` is now a subclass of `RiveMTKView`. `RiveMTKView`'s superclass depends on the device: - On visionOS, this is a `UIView` with an underlying `CAMetalLayer` - On all other platforms, `MTKView` This new class conforms to `RiveMetalDrawableView`, which allows it to be passed to `RenderContext` types. ### RiveMTKView (visionOS) `RiveMTKView` on visionOS is a subclass of `UIView` that is backed by a `CAMetalLayer`, providing the necessary properties of `RiveMetalDrawableView` (compile-time safety here, baby). This is quite a simple recreation of the default `MTKView`, since that type is not available on visionOS (thanks, Apple). ## Other things Additional compile-time checks for platform OS have been added to make sure each new platform compiles with the correct APIs that can be shared, or otherwise newly implemented. Diffs= 6f70a0e803 Add visionOS and tvOS support to Apple runtime (#8107) Co-authored-by: David Skuza <[email protected]>
- Loading branch information
Showing
65 changed files
with
2,217 additions
and
71 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
f69757c8dd221c54942fee2e47bae55df8f6dc12 | ||
6f70a0e803b1eaf43374b98cc4fda6e79163667d |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
Example-iOS/Example (tvOS)/Assets.xcassets/AccentColor.colorset/Contents.json
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,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ssets/App Icon - App Store.imagestack/Back.imagestacklayer/Content.imageset/Contents.json
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,11 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...helf Image.brandassets/App Icon - App Store.imagestack/Back.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
...sets/App Icon & Top Shelf Image.brandassets/App Icon - App Store.imagestack/Contents.json
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,17 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"layers" : [ | ||
{ | ||
"filename" : "Front.imagestacklayer" | ||
}, | ||
{ | ||
"filename" : "Middle.imagestacklayer" | ||
}, | ||
{ | ||
"filename" : "Back.imagestacklayer" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
...sets/App Icon - App Store.imagestack/Front.imagestacklayer/Content.imageset/Contents.json
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,11 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...elf Image.brandassets/App Icon - App Store.imagestack/Front.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ets/App Icon - App Store.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json
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,11 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...lf Image.brandassets/App Icon - App Store.imagestack/Middle.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Content.imageset/Contents.json
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,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...Icon & Top Shelf Image.brandassets/App Icon.imagestack/Back.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
.../Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon.imagestack/Contents.json
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,17 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
}, | ||
"layers" : [ | ||
{ | ||
"filename" : "Front.imagestacklayer" | ||
}, | ||
{ | ||
"filename" : "Middle.imagestacklayer" | ||
}, | ||
{ | ||
"filename" : "Back.imagestacklayer" | ||
} | ||
] | ||
} |
16 changes: 16 additions & 0 deletions
16
...mage.brandassets/App Icon.imagestack/Front.imagestacklayer/Content.imageset/Contents.json
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,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...con & Top Shelf Image.brandassets/App Icon.imagestack/Front.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...age.brandassets/App Icon.imagestack/Middle.imagestacklayer/Content.imageset/Contents.json
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,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
...on & Top Shelf Image.brandassets/App Icon.imagestack/Middle.imagestacklayer/Contents.json
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...e-iOS/Example (tvOS)/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json
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,32 @@ | ||
{ | ||
"assets" : [ | ||
{ | ||
"filename" : "App Icon - App Store.imagestack", | ||
"idiom" : "tv", | ||
"role" : "primary-app-icon", | ||
"size" : "1280x768" | ||
}, | ||
{ | ||
"filename" : "App Icon.imagestack", | ||
"idiom" : "tv", | ||
"role" : "primary-app-icon", | ||
"size" : "400x240" | ||
}, | ||
{ | ||
"filename" : "Top Shelf Image Wide.imageset", | ||
"idiom" : "tv", | ||
"role" : "top-shelf-image-wide", | ||
"size" : "2320x720" | ||
}, | ||
{ | ||
"filename" : "Top Shelf Image.imageset", | ||
"idiom" : "tv", | ||
"role" : "top-shelf-image", | ||
"size" : "1920x720" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...assets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json
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,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...ts.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json
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,16 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "tv", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Oops, something went wrong.