Skip to content

Commit f950c6c

Browse files
harsh62atierianthisisabhashsebaland
authored
feat: adding vision os preview (#3898)
* feat: visionOS support (#3058) * fix readme typo and make instructions clearer (#3070) * fix: update xrOS --> visionOS in os directive checks * chore(build): fix integration tests * fix: Fixing Analytics, Storage and Predictions integration tests * fix: Fixing Push Notification tests. Also reverting some scheme changes. * chore: Updating README * chore: update ReadMe me to remove visionos-preview branch * chore: add visionOS to build and unit test jobs (#3900) * Update Amplify/Core/Configuration/Internal/Amplify+Reset.swift Co-authored-by: Sebastian Villena <[email protected]> * worked on review comments * fixed unit tests * remove the platform checks --------- Co-authored-by: Ian Saultz <[email protected]> Co-authored-by: Abhash Kumar Singh <[email protected]> Co-authored-by: Sebastian Villena <[email protected]>
1 parent 4fcda7e commit f950c6c

File tree

112 files changed

+768
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+768
-395
lines changed

.github/composite_actions/get_platform_parameters/action.yml

+18-9
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ runs:
3434
run: |
3535
INPUT_PLATFORM=${{ inputs.platform }}
3636
case $INPUT_PLATFORM in
37-
iOS|tvOS|watchOS|macOS) ;;
37+
iOS|tvOS|watchOS|macOS|visionOS) ;;
3838
*) echo "Unsupported platform: $INPUT_PLATFORM"; exit 1 ;;
3939
esac
4040
shell: bash
4141

4242
- id: get-xcode-version
4343
run: |
44-
LATEST_XCODE_VERSION=15.3.0
44+
LATEST_XCODE_VERSION=16.0.0
4545
MINIMUM_XCODE_VERSION=15.0.1
4646
4747
INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
@@ -66,35 +66,44 @@ runs:
6666
6767
case $INPUT_PLATFORM/$INPUT_XCODE_VERSION in
6868
iOS/latest)
69-
DEVICE="iPhone 15"
70-
OS_VERSION="17.4"
69+
DEVICE="iPhone 16"
70+
OS_VERSION="18.0"
7171
;;
7272
iOS/*)
7373
DEVICE="iPhone 14"
7474
OS_VERSION="17.0.1"
7575
;;
7676
tvOS/latest)
7777
DEVICE="Apple TV 4K (3rd generation)"
78-
OS_VERSION="17.4"
78+
OS_VERSION="18.0"
7979
;;
8080
tvOS/*)
8181
DEVICE="Apple TV 4K (3rd generation)"
8282
OS_VERSION="17.0"
8383
;;
8484
watchOS/latest)
85-
DEVICE="Apple Watch Series 9 (45mm)"
86-
OS_VERSION="10.4"
85+
DEVICE="Apple Watch Series 10 (46mm)"
86+
OS_VERSION="11.0"
8787
;;
8888
watchOS/*)
8989
DEVICE="Apple Watch Series 8 (45mm)"
9090
OS_VERSION="10.0"
9191
;;
92+
visionOS/latest)
93+
DEVICE="Apple Vision Pro"
94+
OS_VERSION="2.0"
95+
;;
96+
visionOS/*)
97+
DEVICE="Apple Vision Pro"
98+
OS_VERSION="1.0"
99+
;;
92100
esac
93101
94102
DESTINATION_MAPPING="{
95103
\"iOS\": \"platform=iOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
96104
\"tvOS\": \"platform=tvOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
97105
\"watchOS\": \"platform=watchOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
106+
\"visionOS\": \"platform=visionOS Simulator,name=$DEVICE,OS=$OS_VERSION\",
98107
\"macOS\": \"platform=macOS,arch=arm64\"
99108
}"
100109
@@ -119,8 +128,8 @@ runs:
119128
"iOS": "iphonesimulator",
120129
"tvOS": "appletvsimulator",
121130
"watchOS": "watchsimulator",
131+
"visionOS": "xrsimulator",
122132
"macOS": "macosx"
123133
}'
124134
echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
125-
shell: bash
126-
135+
shell: bash

.github/workflows/build_amplify_swift_platforms.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ on:
2727
required: true
2828
default: true
2929
type: boolean
30+
visionos:
31+
description: 'ᯅ visionOS'
32+
required: true
33+
default: true
34+
type: boolean
35+
3036
push:
3137
branches-ignore:
3238
- main
@@ -46,12 +52,13 @@ jobs:
4652
strategy:
4753
fail-fast: false
4854
matrix:
49-
platform: [iOS, macOS, tvOS, watchOS]
55+
platform: [iOS, macOS, tvOS, watchOS, visionOS]
5056
exclude:
5157
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
5258
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
5359
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
5460
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
61+
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
5562
uses: ./.github/workflows/build_scheme.yml
5663
with:
5764
scheme: Amplify-Package

.github/workflows/build_scheme.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ on:
1616

1717
os-runner:
1818
type: string
19-
default: 'macos-latest'
19+
default: 'macos-15'
2020

2121
save_build_cache:
2222
type: boolean

.github/workflows/run_integration_tests.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
inputs:
55
os-runner:
66
type: string
7-
default: 'macos-latest'
7+
default: 'macos-15'
88
scheme:
99
description: 'The scheme to run the tests'
1010
required: true

.github/workflows/run_unit_tests_platforms.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ on:
2424
os-runner:
2525
description: 'runs-on input'
2626
type: string
27-
default: 'macos-latest'
27+
default: 'macos-15'
2828

2929
permissions:
3030
contents: read
@@ -35,12 +35,13 @@ jobs:
3535
strategy:
3636
fail-fast: false
3737
matrix:
38-
platform: [iOS, macOS, tvOS, watchOS]
38+
platform: [iOS, macOS, tvOS, watchOS, visionOS]
3939
exclude:
4040
- platform: ${{ github.event.inputs.ios == 'false' && 'iOS' || 'None' }}
4141
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
4242
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
4343
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
44+
- platform: ${{ github.event.inputs.visionos == 'false' && 'visionOS' || 'None' }}
4445
uses: ./.github/workflows/run_unit_tests.yml
4546
with:
4647
scheme: ${{ inputs.scheme }}

.github/workflows/unit_test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ on:
2828
required: true
2929
default: true
3030
type: boolean
31+
visionos:
32+
description: 'ᯅ visionOS'
33+
required: true
34+
default: true
35+
type: boolean
36+
3137
push:
3238
branches-ignore:
3339
- main

.github/workflows/unit_test_amplify.yml

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
2530

2631
permissions:
2732
contents: read

.github/workflows/unit_test_analytics.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_api.yml

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
2530

2631
permissions:
2732
contents: read

.github/workflows/unit_test_auth.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_core.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_datastore.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_geo.yml

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
2530

2631
permissions:
2732
contents: read

.github/workflows/unit_test_internal_pinpoint.yml

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
2530

2631
permissions:
2732
contents: read

.github/workflows/unit_test_logging.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_predictions.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_push_notifications.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

.github/workflows/unit_test_storage.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ on:
2222
required: true
2323
default: true
2424
type: boolean
25-
25+
visionos:
26+
description: 'ᯅ visionOS'
27+
required: true
28+
default: true
29+
type: boolean
30+
2631
permissions:
2732
contents: read
2833

Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ extension AuthCategory: AuthCategoryBehavior {
3636
return try await plugin.signIn(username: username, password: password, options: options)
3737
}
3838

39-
#if os(iOS) || os(macOS)
39+
#if os(iOS) || os(macOS) || os(visionOS)
4040
public func signInWithWebUI(
4141
presentationAnchor: AuthUIPresentationAnchor? = nil,
4242
options: AuthWebUISignInRequest.Options? = nil) async throws -> AuthSignInResult {

Amplify/Categories/Auth/AuthCategoryBehavior.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
import Foundation
9-
#if os(iOS) || os(macOS)
9+
#if os(iOS) || os(macOS) || os(visionOS)
1010
import AuthenticationServices
1111
public typealias AuthUIPresentationAnchor = ASPresentationAnchor
1212
#endif
@@ -66,7 +66,7 @@ public protocol AuthCategoryBehavior: AuthCategoryUserBehavior, AuthCategoryDevi
6666
password: String?,
6767
options: AuthSignInRequest.Options?) async throws -> AuthSignInResult
6868

69-
#if os(iOS) || os(macOS)
69+
#if os(iOS) || os(macOS) || os(visionOS)
7070
/// SignIn using pre configured web UI.
7171
///
7272
/// Calling this method will always launch the Auth plugin's default web user interface

Amplify/Categories/Auth/Request/AuthSignOutRequest.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public extension AuthSignOutRequest {
3232
/// SignOut the user from all devices. Check the plugin specific definition on what global signOut means.
3333
public let globalSignOut: Bool
3434

35-
#if os(iOS) || os(macOS)
35+
#if os(iOS) || os(macOS) || os(visionOS)
3636
/// Provide a presentation anchor if you have signedIn using `signInWithWebUI`. The signOut webUI will be presented
3737
/// in the presentation anchor provided.
3838
public let presentationAnchorForWebUI: AuthUIPresentationAnchor?
@@ -54,7 +54,7 @@ public extension AuthSignOutRequest {
5454

5555
}
5656

57-
#if os(iOS) || os(macOS)
57+
#if os(iOS) || os(macOS) || os(visionOS)
5858
extension AuthSignOutRequest.Options {
5959
public static func presentationAnchor(_ anchor: AuthUIPresentationAnchor) -> AuthSignOutRequest.Options {
6060
return AuthSignOutRequest.Options(presentationAnchor: anchor)

Amplify/Categories/Auth/Request/AuthWebUISignInRequest.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8-
#if os(iOS) || os(macOS)
8+
#if os(iOS) || os(macOS) || os(visionOS)
99
import Foundation
1010

1111
/// Request to initiate sign in using a web UI.

Amplify/Core/Configuration/Internal/Amplify+Reset.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ extension Amplify {
5151
ModelListDecoderRegistry.reset()
5252
ModelProviderRegistry.reset()
5353
log.verbose("Resetting ModelRegistry, ModelListDecoderRegistry, ModelProviderRegistry finished")
54-
55-
#if os(iOS)
54+
55+
#if os(iOS) && !os(visionOS)
5656
await MainActor.run {
5757
devMenu = nil
5858
}

Amplify/Core/Support/DeviceInfo.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ public struct DeviceInfo {
118118
///
119119
/// - Tag: DeviceInfo.screenBounds
120120
public var screenBounds: CGRect {
121-
#if canImport(WatchKit)
121+
#if os(visionOS)
122+
.zero
123+
#elseif canImport(WatchKit)
122124
.zero
123125
#elseif canImport(UIKit)
124126
UIScreen.main.nativeBounds

0 commit comments

Comments
 (0)