Skip to content

Update OpenSwiftUI_SPI #147

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 9 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 26 additions & 17 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ default:
}

var sharedSwiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("AccessLevelOnImport"),
.enableUpcomingFeature("BareSlashRegexLiterals"),
// .enableUpcomingFeature("InternalImportsByDefault"),
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
.define("OPENSWIFTUI_RELEASE_\(releaseVersion)"),
.swiftLanguageMode(.v5),
.enableUpcomingFeature("BareSlashRegexLiterals"),
]

if releaseVersion >= 2021 {
Expand All @@ -86,18 +86,20 @@ if warningsAsErrorsCondition {
sharedSwiftSettings.append(.unsafeFlags(["-warnings-as-errors"]))
}

// NOTE:
// In macOS: Mac Catalyst App will use macOS-varient build of SwiftUI.framework in /System/Library/Framework and iOS varient of SwiftUI.framework in /System/iOSSupport/System/Library/Framework
// Add `|| Mac Catalyst` check everywhere in `OpenSwiftUICore` and `OpenSwiftUI_SPI`.
let openSwiftUICoreTarget = Target.target(
name: "OpenSwiftUICore",
dependencies: [
"COpenSwiftUICore",
"OpenSwiftUI_SPI",
.product(name: "OpenGraphShims", package: "OpenGraph"),
],
swiftSettings: sharedSwiftSettings
)
let openSwiftUITarget = Target.target(
name: "OpenSwiftUI",
dependencies: [
"COpenSwiftUI",
"OpenSwiftUICore",
.target(name: "CoreServices", condition: .when(platforms: [.iOS])),
.product(name: "OpenGraphShims", package: "OpenGraph"),
Expand All @@ -111,6 +113,17 @@ let openSwiftUIExtensionTarget = Target.target(
],
swiftSettings: sharedSwiftSettings
)
let OpenSwiftUI_SPITestTarget = Target.testTarget(
name: "OpenSwiftUI_SPITests",
dependencies: [
"OpenSwiftUI_SPI",
// For ProtocolDescriptor symbol linking
"OpenSwiftUI",
.product(name: "Numerics", package: "swift-numerics")
],
exclude: ["README.md"],
swiftSettings: sharedSwiftSettings
)
let openSwiftUICoreTestTarget = Target.testTarget(
name: "OpenSwiftUICoreTests",
dependencies: [
Expand Down Expand Up @@ -144,7 +157,10 @@ let package = Package(
products: [
.library(name: "OpenSwiftUI", targets: ["OpenSwiftUI", "OpenSwiftUIExtension"]),
// FIXME: This will block xcodebuild build(iOS CI) somehow
// .library(name: "COpenSwiftUI", targets: ["COpenSwiftUI"]),
// .library(name: "OpenSwiftUI_SPI", targets: ["OpenSwiftUI_SPI"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-numerics.git", from: "1.0.2"),
],
targets: [
// TODO: Add SwiftGTK as an backend alternative for UIKit/AppKit on Linux and macOS
Expand All @@ -157,18 +173,8 @@ let package = Package(
]
),
.target(
name: "COpenSwiftUI",
dependencies: [
"COpenSwiftUICore",
],
cSettings: [
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
.define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
]
),
.target(
name: "COpenSwiftUICore",
name: "OpenSwiftUI_SPI",
publicHeadersPath: ".",
cSettings: [
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
Expand All @@ -180,6 +186,7 @@ let package = Package(
openSwiftUITarget,
openSwiftUIExtensionTarget,

OpenSwiftUI_SPITestTarget,
openSwiftUICoreTestTarget,
openSwiftUITestTarget,
openSwiftUICompatibilityTestTarget,
Expand Down Expand Up @@ -227,6 +234,8 @@ extension Target {
if attributeGraphCondition {
openSwiftUICoreTarget.addAGSettings()
openSwiftUITarget.addAGSettings()

OpenSwiftUI_SPITestTarget.addAGSettings()
openSwiftUICoreTestTarget.addAGSettings()
openSwiftUITestTarget.addAGSettings()
openSwiftUICompatibilityTestTarget.addAGSettings()
Expand Down
22 changes: 6 additions & 16 deletions [email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,11 @@ default:
}

var sharedSwiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableExperimentalFeature("AccessLevelOnImport"),
// .enableUpcomingFeature("InternalImportsByDefault"),
.define("OPENSWIFTUI_SUPPRESS_DEPRECATED_WARNINGS"),
.define("OPENSWIFTUI_RELEASE_\(releaseVersion)"),
.enableUpcomingFeature("BareSlashRegexLiterals"),
]

if releaseVersion >= 2021 {
Expand All @@ -85,15 +86,14 @@ if warningsAsErrorsCondition {
let openSwiftUICoreTarget = Target.target(
name: "OpenSwiftUICore",
dependencies: [
"COpenSwiftUICore",
"OpenSwiftUI_SPI",
.product(name: "OpenGraphShims", package: "OpenGraph"),
],
swiftSettings: sharedSwiftSettings
)
let openSwiftUITarget = Target.target(
name: "OpenSwiftUI",
dependencies: [
"COpenSwiftUI",
"OpenSwiftUICore",
.target(name: "CoreServices", condition: .when(platforms: [.iOS])),
.product(name: "OpenGraphShims", package: "OpenGraph"),
Expand Down Expand Up @@ -140,7 +140,7 @@ let package = Package(
products: [
.library(name: "OpenSwiftUI", targets: ["OpenSwiftUI", "OpenSwiftUIExtension"]),
// FIXME: This will block xcodebuild build(iOS CI) somehow
// .library(name: "COpenSwiftUI", targets: ["COpenSwiftUI"]),
// .library(name: "OpenSwiftUI_SPI", targets: ["OpenSwiftUI_SPI"]),
],
targets: [
// TODO: Add SwiftGTK as an backend alternative for UIKit/AppKit on Linux and macOS
Expand All @@ -153,18 +153,8 @@ let package = Package(
]
),
.target(
name: "COpenSwiftUI",
dependencies: [
"COpenSwiftUICore",
],
cSettings: [
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
.define("_WASI_EMULATED_SIGNAL", .when(platforms: [.wasi])),
]
),
.target(
name: "COpenSwiftUICore",
name: "OpenSwiftUI_SPI",
publicHeadersPath: ".",
cSettings: [
.unsafeFlags(["-I", includePath], .when(platforms: .nonDarwinPlatforms)),
.define("__COREFOUNDATION_FORSWIFTFOUNDATIONONLY__", to: "1", .when(platforms: .nonDarwinPlatforms)),
Expand Down
1 change: 0 additions & 1 deletion Sources/COpenSwiftUI/empty.c

This file was deleted.

1 change: 0 additions & 1 deletion Sources/COpenSwiftUI/include/empty.h

This file was deleted.

16 changes: 0 additions & 16 deletions Sources/COpenSwiftUICore/Shims/CoreFoundation_Private.c

This file was deleted.

27 changes: 0 additions & 27 deletions Sources/COpenSwiftUICore/include/dyld_Private.h

This file was deleted.

2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/Integration/UIKit/UIGraphicsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Status: Complete

#if os(iOS)
internal import COpenSwiftUI
internal import OpenSwiftUI_SPI
import UIKit

class _UIGraphicsView: UIView {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUI/Test/_PerformanceTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import UIKit
import AppKit
#endif

internal import COpenSwiftUI
internal import OpenSwiftUI_SPI

public protocol _PerformanceTest: _Test {
var name: String { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Status: Complete
// ID: 6C985860B64B768EC9A2691B5DBA71A0

internal import COpenSwiftUI
internal import OpenSwiftUI_SPI

extension View {
func buttonDefaultRenderingMode() -> some View {
Expand Down
4 changes: 2 additions & 2 deletions Sources/OpenSwiftUI/View/Control/Link/OpenURLActionKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#if canImport(Darwin)
#if os(iOS) || os(tvOS)
import UIKit
#if os(iOS)
#if os(iOS) && !targetEnvironment(macCatalyst)
private import CoreServices
#endif
#elseif os(macOS)
Expand Down Expand Up @@ -37,7 +37,7 @@ struct OpenSensitiveURLActionKey: EnvironmentKey {

static let defaultValue = OpenURLAction(
handler: .system { url, completion in
#if os(iOS)
#if os(iOS) && !targetEnvironment(macCatalyst)
let config = _LSOpenConfiguration()
config.isSensitive = true
let selector = Selector(("_currentOpenApplicationEndpoint"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if OPENSWIFTUI_RELEASE_2021

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

package extension LockedPointer {
@_transparent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if OPENSWIFTUI_RELEASE_2021

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

package struct UnsafeAtomicLazy<Data>: Destroyable {
@UnsafeLockedPointer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#if OPENSWIFTUI_RELEASE_2021

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

@propertyWrapper
package struct UnsafeLockedPointer<Data>: Destroyable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUICore/Data/Property/PropertyList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ID: 2B32D570B0B3D2A55DA9D4BFC1584D20 (RELEASE_2021)
// ID: D64CE6C88E7413721C59A34C0C940F2C (RELEASE_2024)

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI
internal import OpenGraphShims

// MARK: - PropertyList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import OpenCombine
#else
import Combine
#endif
internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

struct ObservableObjectLocation<Root, Value>: Location where Root: ObservableObject {
let base: Root
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUICore/Data/State/StoredLocation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ID: 4F21368B1C1680817451AC25B55A8D48 (RELEASE_2024)

internal import OpenGraphShims
internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

package class StoredLocationBase<Value>: AnyLocation<Value>, Location, @unchecked Sendable {
private struct Data {
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUICore/Data/Transaction/Transaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ID: B2543BCA257433E04979186A1DC2B6BC

internal import OpenGraphShims
internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

/// The context of the current state-processing update.
///
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUICore/Data/Update.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ID: EA173074DA35FA471DC70643259B7E74 (RELEASE_2021)
// ID: 61534957AEEC2EDC447ABDC13B4D426F (RELEASE_2024)

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI
internal import OpenGraphShims
import Foundation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Status: WIP

import Foundation
internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

protocol ContentResponder {
func contains(points: [CGPoint], size: CGSize) -> BitVector64
Expand Down
2 changes: 1 addition & 1 deletion Sources/OpenSwiftUICore/Graph/GraphHost.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// ID: 30C09FF16BC95EC5173809B57186CAC3 (RELEASE_2021)
// ID: F9F204BD2F8DB167A76F17F3FB1B3335 (RELEASE_2024)

internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI
package import OpenGraphShims
import Foundation

Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenSwiftUICore/Graphic/Color/ColorResolved.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// Status: WIP

import Foundation
internal import COpenSwiftUICore
internal import OpenSwiftUI_SPI

// MARK: - Color.Resolved

Expand Down Expand Up @@ -322,7 +322,7 @@
var green: CGFloat = 0
var blue: CGFloat = 0
var alpha: CGFloat = 0
let result = CoreColorPlatformColorGetComponents(isAppKitBased(), platformColor, &red, &green, &blue, &alpha)
let result = OpenSwiftUICoreColorPlatformColorGetComponents(isAppKitBased(), platformColor, &red, &green, &blue, &alpha)

Check warning on line 325 in Sources/OpenSwiftUICore/Graphic/Color/ColorResolved.swift

View check run for this annotation

Codecov / codecov/patch

Sources/OpenSwiftUICore/Graphic/Color/ColorResolved.swift#L325

Added line #L325 was not covered by tests
if result {
self.init(red: Float(red), green: Float(green), blue: Float(blue), opacity: Float(alpha))
} else {
Expand All @@ -332,7 +332,7 @@

// ID: 4330A474F53D66045762501ED6F8A749
private static let cache: ObjectCache<Color.Resolved, NSObject> = ObjectCache { resolved in
CoreColor.platformColor(resolvedColor: resolved)!
OpenSwiftUICoreColor.platformColor(resolvedColor: resolved)!
}

package var kitColor: NSObject {
Expand Down
Loading
Loading