Skip to content

Commit

Permalink
Update View Input and Output (#157)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Kyle-Ye authored Nov 17, 2024
1 parent bbcd8be commit 97dcc6c
Show file tree
Hide file tree
Showing 42 changed files with 1,590 additions and 874 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"originHash" : "6ae2798ced7417c65233e0130814db449aa933d9f98ec74d935b06b494949ef9",
"originHash" : "5c37246fc3829f800b0ccd442988c364c2beeffc296cdc8b4f7ce1585eebc14a",
"pins" : [
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "93e713f1357fc04ca917635d09460dbf42b663b6"
"revision" : "f2b16a1145acadd47c708d528f7eb1047d412f78"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ let development = envEnable("OPENSWIFTUI_DEVELOPMENT", default: false)
// Xcode use clang as linker which supports "-iframework" while SwiftPM use swiftc as linker which supports "-Fsystem"
let systemFrameworkSearchFlag = isXcodeEnv ? "-iframework" : "-Fsystem"

let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2021
let releaseVersion = Context.environment["OPENSWIFTUI_TARGET_RELEASE"].flatMap { Int($0) } ?? 2024
let platforms: [SupportedPlatform] = switch releaseVersion {
case 2024: // iOS 18.0
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
// InterfaceIdiom.swift
// OpenSwiftUI
//
// Audited for iOS 15.5
// Audited for iOS 15.0
// Status: Complete
// ID: 2FFD16F575FFD9B8AC17BCAE09549F2
// ID: 2FFD16F575FFD9B8AC17BCAE09549F23 (SwiftUI)

#if OPENSWIFTUI_RELEASE_2021

// MARK: InterfaceIdiomType

Expand Down Expand Up @@ -112,3 +114,27 @@ extension UIUserInterfaceIdiom {
}
}
#endif

#elseif OPENSWIFTUI_RELEASE_2024

#if os(iOS) || os(tvOS)
import OpenSwiftUICore
import UIKit

extension UIUserInterfaceIdiom {
var idiom: AnyInterfaceIdiom? {
switch rawValue {
case UIUserInterfaceIdiom.phone.rawValue: return AnyInterfaceIdiom(.phone)
case UIUserInterfaceIdiom.pad.rawValue: return AnyInterfaceIdiom(.pad)
case UIUserInterfaceIdiom.tv.rawValue: return AnyInterfaceIdiom(.tv)
case 4: return AnyInterfaceIdiom(.watch) // There is no UIUserInterfaceIdiom.watch exposed currently
case UIUserInterfaceIdiom.carPlay.rawValue: return AnyInterfaceIdiom(.carPlay)
case UIUserInterfaceIdiom.mac.rawValue: return AnyInterfaceIdiom(.mac)
case UIUserInterfaceIdiom.vision.rawValue: return AnyInterfaceIdiom(.vision)
default: return nil
}
}
}
#endif

#endif
18 changes: 11 additions & 7 deletions Sources/OpenSwiftUICore/Data/Environment/CachedEnvironment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,17 @@ package struct CachedEnvironment {
#endif
}

// func animatePosition(for inputs: _ViewInputs) -> Attribute<ViewOrigin> {
// fatalError("TODO")
// }
//
// func animateSize(for inputs: _ViewInputs) -> Attribute<ViewSize> {
// fatalError("TODO")
// }
func animatedPosition(for inputs: _ViewInputs) -> Attribute<ViewOrigin> {
fatalError("TODO")
}

func animatedSize(for inputs: _ViewInputs) -> Attribute<ViewSize> {
fatalError("TODO")
}

func animatedCGSize(for inputs: _ViewInputs) -> Attribute<CGSize> {
fatalError("TODO")
}

// func resolvedForegroundStyle() {}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// EnvironmentValues+IsVisionEnabledKey.swift
// OpenSwiftUICore
//
// Audited for iOS 18.0
// Status: Complete

extension EnvironmentValues {
package var isVisionEnabled: Bool {
get {
#if os(macOS)
false
#else
self[IsVisionEnabledKey.self]
#endif
}
set { self[IsVisionEnabledKey.self] = newValue }
}
}

package struct IsVisionEnabledKey: EnvironmentKey {
package static let defaultValue: Bool = false

package typealias Value = Bool
}
4 changes: 1 addition & 3 deletions Sources/OpenSwiftUICore/Data/Other/VersionSeed.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// VersionSeed.swift
// OpenSwiftUI
// OpenSwiftUICore
//
// Audited for iOS 18.0
// Status: Complete
Expand Down Expand Up @@ -64,8 +64,6 @@ package struct VersionSeed: CustomStringConvertible {
}
}

// ID: 1B00D77CE2C80F9C0F5A59FDEA30ED6B (RELEASE_2021)
// ID: F99DF4753FB5F5765C388695646E450B (RELEASE_2024)
private func merge32(_ a: UInt32, _ b: UInt32) -> UInt32 {
let a = UInt64(a)
let b = UInt64(b)
Expand Down
Loading

0 comments on commit 97dcc6c

Please sign in to comment.