Skip to content

Commit

Permalink
Vision os support (#43)
Browse files Browse the repository at this point in the history
* Added support for visionOS

* Maintenance (#38)

* Updated testable combine publishers

* Fixed Swift 6 conflicting generic aliases warning

* Fixed Xcode 14.3 UI test bug

* Update CI macOS and Xcode versions

* build destination corrections

* tidy up ci devices

* Fix flaky tests

* Upgrade actions

* Temporarily™ disabled broken UI tests

* Bumpped CI to use Xcode 15.2. Also enabled unit tests for the VisionOS test target

---------

Co-authored-by: Bill Dunay <[email protected]>
Co-authored-by: Albert Bori <[email protected]>
  • Loading branch information
3 people authored Jan 18, 2024
1 parent bb6249a commit 10dafb9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Prepare Xcode
uses: maxim-lobanov/setup-xcode@v1 # https://github.com/marketplace/actions/setup-xcode-version
with:
xcode-version: 15.0.1
xcode-version: 15.2.0

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -58,6 +58,14 @@ jobs:
scheme: VSM
destination: platform=tvOS Simulator,OS=17.0,name=Apple TV 4K (3rd generation) (at 1080p)
action: test

- name: Build and Test VSM on visionOS
uses: sersoft-gmbh/xcodebuild-action@v3 # https://github.com/marketplace/actions/xcodebuild-action
with:
spm-package: ./
scheme: VSM
destination: platform=visionOS Simulator,OS=1.0,name=Apple Vision Pro
action: test

# The following jobs are disabled until further notice to unblock work
# Xcode currently has UI test runtime issues since Xcode 14.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Prepare Xcode
uses: maxim-lobanov/setup-xcode@v1 # https://github.com/marketplace/actions/setup-xcode-version
with:
xcode-version: 15.0.1
xcode-version: 15.2.0

- name: Checkout
uses: actions/checkout@v4
Expand Down
5 changes: 3 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.7
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand All @@ -9,7 +9,8 @@ let package = Package(
.iOS(.v13),
.macOS(.v11),
.watchOS(.v6),
.tvOS(.v13)
.tvOS(.v13),
.visionOS(.v1)
],
products: [
.library(
Expand Down
1 change: 1 addition & 0 deletions Sources/VSM/StateObject+StateInit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import SwiftUI
@available(iOS 14.0, *)
@available(tvOS 14.0, *)
@available(watchOS 7.0, *)
@available(visionOS 1.0, *)
@available(*, deprecated, message: "Use the @ViewState property wrapper instead.")
public extension StateObject {

Expand Down
3 changes: 3 additions & 0 deletions Sources/VSM/ViewState/RenderedViewState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import Combine
/// }
/// ```
@available(iOS 14.0, *)
@available(visionOS 1.0, *)
@propertyWrapper
public struct RenderedViewState<State> {

Expand Down Expand Up @@ -187,6 +188,7 @@ public struct RenderedViewState<State> {
// MARK: - RenderedViewState

@available(iOS 14.0, *)
@available(visionOS 1.0, *)
public extension RenderedViewState {
/// Provides functions for observing and rendering state changes in UIKit views and view controllers
struct RenderedContainer {
Expand Down Expand Up @@ -236,6 +238,7 @@ public extension RenderedViewState {

// Forwards protocol member calls to underlying state container
@available(iOS 14.0, *)
@available(visionOS 1.0, *)
extension RenderedViewState.RenderedContainer: StateObserving & StatePublishing {

// MARK: StatePublishing
Expand Down
2 changes: 2 additions & 0 deletions Sources/VSM/ViewState/ViewState+Debug.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

#if DEBUG

@available(macOS 11, *)
@available(iOS 14.0, *)
@available(tvOS 14.0, *)
@available(watchOS 7.0, *)
@available(visionOS 1.0, *)
extension ViewState: _StateContainerStaticDebugging where State == Any { }

#endif
2 changes: 2 additions & 0 deletions Sources/VSM/ViewState/ViewState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ import SwiftUI
/// }
/// }
/// ```
@available(macOS 11, *)
@available(iOS 14.0, *)
@available(tvOS 14.0, *)
@available(watchOS 7.0, *)
@available(visionOS 1.0, *)
@propertyWrapper
public struct ViewState<State>: DynamicProperty {

Expand Down

0 comments on commit 10dafb9

Please sign in to comment.