Skip to content

Commit 97dcc6c

Browse files
authored
Update View Input and Output (#157)
* Update ViewOutputs to 2024 * Remove ID identifier * Update ViewInputPredicate * Update InterfaceIdiom * Update vision related implementation * Update ViewInputs to 2024 * Update PreferencesInputs and fix compile issue * Update View_Indirect * Fix non-Darwin build issue and update combiner * Complete PreferencesCombiner * Update PreferenceList * Update PreferenceBridge implementation
1 parent bbcd8be commit 97dcc6c

Some content is hidden

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

42 files changed

+1590
-874
lines changed

Package.resolved

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"originHash" : "6ae2798ced7417c65233e0130814db449aa933d9f98ec74d935b06b494949ef9",
2+
"originHash" : "5c37246fc3829f800b0ccd442988c364c2beeffc296cdc8b4f7ce1585eebc14a",
33
"pins" : [
44
{
55
"identity" : "opengraph",
66
"kind" : "remoteSourceControl",
77
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
88
"state" : {
99
"branch" : "main",
10-
"revision" : "93e713f1357fc04ca917635d09460dbf42b663b6"
10+
"revision" : "f2b16a1145acadd47c708d528f7eb1047d412f78"
1111
}
1212
},
1313
{

Package.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let development = envEnable("OPENSWIFTUI_DEVELOPMENT", default: false)
2323
// Xcode use clang as linker which supports "-iframework" while SwiftPM use swiftc as linker which supports "-Fsystem"
2424
let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem"
2525

26-
let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2021
26+
let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2024
2727
let platforms: [SupportedPlatform] = switch releaseVersion {
2828
case 2024: // iOS 18.0
2929
[

Sources/OpenSwiftUICore/View/InterfaceIdiom.swift renamed to Sources/OpenSwiftUI/View/InterfaceIdiom/InterfaceIdiom.swift

+28-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
// InterfaceIdiom.swift
33
// OpenSwiftUI
44
//
5-
// Audited for iOS 15.5
5+
// Audited for iOS 15.0
66
// Status: Complete
7-
// ID: 2FFD16F575FFD9B8AC17BCAE09549F2
7+
// ID: 2FFD16F575FFD9B8AC17BCAE09549F23 (SwiftUI)
8+
9+
#if OPENSWIFTUI_RELEASE_2021
810

911
// MARK: InterfaceIdiomType
1012

@@ -112,3 +114,27 @@ extension UIUserInterfaceIdiom {
112114
}
113115
}
114116
#endif
117+
118+
#elseif OPENSWIFTUI_RELEASE_2024
119+
120+
#if os(iOS) || os(tvOS)
121+
import OpenSwiftUICore
122+
import UIKit
123+
124+
extension UIUserInterfaceIdiom {
125+
var idiom: AnyInterfaceIdiom? {
126+
switch rawValue {
127+
case UIUserInterfaceIdiom.phone.rawValue: return AnyInterfaceIdiom(.phone)
128+
case UIUserInterfaceIdiom.pad.rawValue: return AnyInterfaceIdiom(.pad)
129+
case UIUserInterfaceIdiom.tv.rawValue: return AnyInterfaceIdiom(.tv)
130+
case 4: return AnyInterfaceIdiom(.watch) // There is no UIUserInterfaceIdiom.watch exposed currently
131+
case UIUserInterfaceIdiom.carPlay.rawValue: return AnyInterfaceIdiom(.carPlay)
132+
case UIUserInterfaceIdiom.mac.rawValue: return AnyInterfaceIdiom(.mac)
133+
case UIUserInterfaceIdiom.vision.rawValue: return AnyInterfaceIdiom(.vision)
134+
default: return nil
135+
}
136+
}
137+
}
138+
#endif
139+
140+
#endif

Sources/OpenSwiftUICore/Data/Environment/CachedEnvironment.swift

+11-7
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,17 @@ package struct CachedEnvironment {
5757
#endif
5858
}
5959

60-
// func animatePosition(for inputs: _ViewInputs) -> Attribute<ViewOrigin> {
61-
// fatalError("TODO")
62-
// }
63-
//
64-
// func animateSize(for inputs: _ViewInputs) -> Attribute<ViewSize> {
65-
// fatalError("TODO")
66-
// }
60+
func animatedPosition(for inputs: _ViewInputs) -> Attribute<ViewOrigin> {
61+
fatalError("TODO")
62+
}
63+
64+
func animatedSize(for inputs: _ViewInputs) -> Attribute<ViewSize> {
65+
fatalError("TODO")
66+
}
67+
68+
func animatedCGSize(for inputs: _ViewInputs) -> Attribute<CGSize> {
69+
fatalError("TODO")
70+
}
6771

6872
// func resolvedForegroundStyle() {}
6973
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// EnvironmentValues+IsVisionEnabledKey.swift
3+
// OpenSwiftUICore
4+
//
5+
// Audited for iOS 18.0
6+
// Status: Complete
7+
8+
extension EnvironmentValues {
9+
package var isVisionEnabled: Bool {
10+
get {
11+
#if os(macOS)
12+
false
13+
#else
14+
self[IsVisionEnabledKey.self]
15+
#endif
16+
}
17+
set { self[IsVisionEnabledKey.self] = newValue }
18+
}
19+
}
20+
21+
package struct IsVisionEnabledKey: EnvironmentKey {
22+
package static let defaultValue: Bool = false
23+
24+
package typealias Value = Bool
25+
}

Sources/OpenSwiftUICore/Data/Other/VersionSeed.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// VersionSeed.swift
3-
// OpenSwiftUI
3+
// OpenSwiftUICore
44
//
55
// Audited for iOS 18.0
66
// Status: Complete
@@ -64,8 +64,6 @@ package struct VersionSeed: CustomStringConvertible {
6464
}
6565
}
6666

67-
// ID: 1B00D77CE2C80F9C0F5A59FDEA30ED6B (RELEASE_2021)
68-
// ID: F99DF4753FB5F5765C388695646E450B (RELEASE_2024)
6967
private func merge32(_ a: UInt32, _ b: UInt32) -> UInt32 {
7068
let a = UInt64(a)
7169
let b = UInt64(b)

0 commit comments

Comments
 (0)