-
Notifications
You must be signed in to change notification settings - Fork 61
[Bug Fix] Fix UIImage to Image environment override issue #823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
66b6213
Update resolvedTraitCollection implementation
Kyle-Ye 6f1290b
Update TypesettingConfigurationKey
Kyle-Ye c7af71a
Update resolvedEnviornment
Kyle-Ye 35b1c7c
Add updateFidelity API
Kyle-Ye e848c45
Update _colorSchemeContrast
Kyle-Ye f7093e8
Add effectiveColorScheme
Kyle-Ye 5aea929
Update displayCornerRadius
Kyle-Ye 6fa8da1
Update Material
Kyle-Ye 5f82988
Update Package.resolved
Kyle-Ye f88b951
Fix header issue
Kyle-Ye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,20 @@ | ||
| // | ||
| // UIBacklightLuminance.h | ||
| // COpenSwiftUI | ||
|
|
||
| #include "OpenSwiftUIBase.h" | ||
|
|
||
| #if __has_include(<UIKit/UIKit.h>) && !__has_include(<UIKitPrivate/UIBacklightLuminance.h>) | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| NS_HEADER_AUDIT_BEGIN(nullability, sendability) | ||
|
|
||
| typedef NS_ENUM(NSInteger, _UIBacklightLuminance) { | ||
| _UIBacklightLuminanceNormal = 0, | ||
| _UIBacklightLuminanceReduced = 1, | ||
| }; | ||
|
|
||
| NS_HEADER_AUDIT_END(nullability, sendability) | ||
|
|
||
| #endif |
44 changes: 44 additions & 0 deletions
44
Sources/COpenSwiftUI/Shims/UIKit/UITraitCollection+Private.h
This file contains hidden or 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,44 @@ | ||
| // | ||
| // UITraitCollection+Private.h | ||
| // COpenSwiftUI | ||
| // | ||
| // Status: Complete | ||
|
|
||
| #ifndef UITraitCollection_Private_h | ||
| #define UITraitCollection_Private_h | ||
|
|
||
| #include "OpenSwiftUIBase.h" | ||
|
|
||
| #if __has_include(<UIKit/UIKit.h>) | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
| #include "Shims/UIKit/UIUserInterfaceVibrancy.h" | ||
| #include "Shims/UIKit/UIBacklightLuminance.h" | ||
| #if OPENSWIFTUI_LINK_BACKLIGHTSERVICES | ||
| #import <BacklightServices/BacklightServices.h> | ||
| #endif | ||
|
|
||
| NS_HEADER_AUDIT_BEGIN(nullability, sendability) | ||
|
|
||
| @interface UITraitCollection (OpenSwiftUI_Private) | ||
|
|
||
| @property (nonatomic, readonly) UITraitCollection *_traitCollectionByRemovingEnvironmentWrapper_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_traitCollectionByRemovingEnvironmentWrapper); | ||
| @property (nonatomic, readonly) _UIBacklightLuminance _backlightLuminance_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_backlightLuminance); | ||
| @property (nonatomic, readonly) NSInteger _userInterfaceRenderingMode_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_userInterfaceRenderingMode); | ||
| @property (nonatomic, readonly) CGFloat displayCornerRadius_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(displayCornerRadius); | ||
| @property (nonatomic, readonly) _UIUserInterfaceVibrancy _vibrancy_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_vibrancy); | ||
|
|
||
| #if OPENSWIFTUI_LINK_BACKLIGHTSERVICES | ||
| @property (nonatomic, readonly) BLSUpdateFidelity _updateFidelity_openswiftui_safe_wrapper OPENSWIFTUI_SWIFT_NAME(_updateFidelity); | ||
| #endif | ||
|
|
||
| @end | ||
|
|
||
| OPENSWIFTUI_EXPORT | ||
| const CGFloat _UITraitCollectionDisplayCornerRadiusUnspecified; | ||
|
|
||
| NS_HEADER_AUDIT_END(nullability, sendability) | ||
|
|
||
| #endif /* __has_include(<UIKit/UIKit.h>) */ | ||
|
|
||
| #endif /* UITraitCollection_Private_h */ |
49 changes: 49 additions & 0 deletions
49
Sources/COpenSwiftUI/Shims/UIKit/UITraitCollection+Private.m
This file contains hidden or 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,49 @@ | ||
| // | ||
| // UITraitCollection+Private.m | ||
| // COpenSwiftUI | ||
| // | ||
| // Status: Complete | ||
|
|
||
| #import "UITraitCollection+Private.h" | ||
| #import "Shims/OpenSwiftUIShims.h" | ||
|
|
||
| #if __has_include(<UIKit/UIKit.h>) | ||
| #import <objc/runtime.h> | ||
|
|
||
| @implementation UITraitCollection (OpenSwiftUI_Private) | ||
|
|
||
| - (UITraitCollection *)_traitCollectionByRemovingEnvironmentWrapper_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(UITraitCollection *, @"_traitCollectionByRemovingEnvironmentWrapper", self); | ||
| return func(self, selector); | ||
| } | ||
|
|
||
| - (_UIBacklightLuminance)_backlightLuminance_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(_UIBacklightLuminance, @"_backlightLuminance", _UIBacklightLuminanceNormal); | ||
| return func(self, selector); | ||
| } | ||
|
|
||
| - (NSInteger)_userInterfaceRenderingMode_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(NSInteger, @"_userInterfaceRenderingMode", 0); | ||
| return func(self, selector); | ||
| } | ||
|
|
||
| - (CGFloat)displayCornerRadius_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(CGFloat, @"displayCornerRadius", 0.0); | ||
| return func(self, selector); | ||
| } | ||
|
|
||
| - (_UIUserInterfaceVibrancy)_vibrancy_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(_UIUserInterfaceVibrancy, @"_vibrancy", _UIUserInterfaceVibrancyUnspecified); | ||
| return func(self, selector); | ||
| } | ||
|
|
||
| #if OPENSWIFTUI_LINK_BACKLIGHTSERVICES | ||
| - (BLSUpdateFidelity)_updateFidelity_openswiftui_safe_wrapper { | ||
| OPENSWIFTUI_SAFE_WRAPPER_IMP(BLSUpdateFidelity, @"_updateFidelity", BLSUpdateFidelityUnspecified); | ||
| return func(self, selector); | ||
| } | ||
| #endif | ||
|
|
||
| @end | ||
|
|
||
| #endif /* __has_include(<UIKit/UIKit.h>) */ |
21 changes: 21 additions & 0 deletions
21
Sources/COpenSwiftUI/Shims/UIKit/UIUserInterfaceVibrancy.h
This file contains hidden or 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,21 @@ | ||
| // | ||
| // UIUserInterfaceVibrancy.h | ||
| // COpenSwiftUI | ||
|
|
||
| #include "OpenSwiftUIBase.h" | ||
|
|
||
| #if __has_include(<UIKit/UIKit.h>) && !__has_include(<UIKitPrivate/UIUserInterfaceVibrancy.h>) | ||
|
|
||
| #import <UIKit/UIKit.h> | ||
|
|
||
| NS_HEADER_AUDIT_BEGIN(nullability, sendability) | ||
|
|
||
| typedef NS_ENUM(NSInteger, _UIUserInterfaceVibrancy) { | ||
| _UIUserInterfaceVibrancyUnspecified = -1, | ||
| _UIUserInterfaceVibrancyNone = 0, | ||
| _UIUserInterfaceVibrancyVibrant = 1, | ||
| }; | ||
|
|
||
| NS_HEADER_AUDIT_END(nullability, sendability) | ||
|
|
||
| #endif |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
33 changes: 33 additions & 0 deletions
33
Sources/OpenSwiftUI/View/Text/Typesetting/TypesettingConfiguration.swift
This file contains hidden or 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,33 @@ | ||
| // | ||
| // TypesettingConfiguration.swift | ||
| // OpenSwiftUI | ||
| // | ||
| // Audited for 6.5.4 | ||
| // Status: Complete | ||
|
|
||
| #if canImport(UIKit) | ||
| package import UIKit | ||
|
|
||
| // MARK: - TypesettingConfigurationKey + UITraitBridgedEnvironmentKey | ||
|
|
||
| extension TypesettingConfigurationKey: UITraitBridgedEnvironmentKey { | ||
| package static func read(from traitCollection: UITraitCollection) -> TypesettingConfiguration { | ||
| if let language = traitCollection.typesettingLanguage { | ||
| TypesettingConfiguration(language: .explicit(language)) | ||
| } else { | ||
| TypesettingConfiguration(language: .automatic) | ||
| } | ||
| } | ||
|
|
||
| package static func write(to mutableTraits: inout any UIMutableTraits, value: TypesettingConfiguration) { | ||
| switch value.language.storage { | ||
| case .explicit(let language, _): | ||
| mutableTraits.typesettingLanguage = language | ||
| case .automatic, .contentAware: | ||
| mutableTraits.typesettingLanguage = nil | ||
| @unknown default: | ||
| _openSwiftUIUnreachableCode() | ||
| } | ||
| } | ||
| } | ||
| #endif |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.