Skip to content
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
10 changes: 10 additions & 0 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

/* Begin PBXBuildFile section */
27186AE32D538A76009E05F9 /* AttributeGraph.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27E6C4D12D2842740010502F /* AttributeGraph.xcframework */; };
273F46082F673F8F00F3379F /* CoreSVG.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F46072F673F8F00F3379F /* CoreSVG.xcframework */; };
273F48CA2F6743CC00F3379F /* CoreSVG.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F46072F673F8F00F3379F /* CoreSVG.xcframework */; };
273F48CD2F6743D300F3379F /* CoreSVG.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F46072F673F8F00F3379F /* CoreSVG.xcframework */; };
273F48D02F6743D900F3379F /* CoreSVG.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 273F46072F673F8F00F3379F /* CoreSVG.xcframework */; };
278EF52D2E2272F2009C32EB /* Equatable in Frameworks */ = {isa = PBXBuildFile; productRef = 278EF52C2E2272F2009C32EB /* Equatable */; };
278EF52F2E227304009C32EB /* Equatable in Frameworks */ = {isa = PBXBuildFile; productRef = 278EF52E2E227304009C32EB /* Equatable */; };
279284972DFF136E00234D64 /* AttributeGraph.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27E6C4D12D2842740010502F /* AttributeGraph.xcframework */; };
Expand Down Expand Up @@ -56,6 +60,7 @@

/* Begin PBXFileReference section */
271D81642BB1E8E300A6D543 /* OpenAttributeGraph */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = OpenAttributeGraph; path = ../../OpenAttributeGraph; sourceTree = "<group>"; };
273F46072F673F8F00F3379F /* CoreSVG.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = CoreSVG.xcframework; path = ../../DarwinPrivateFrameworks/CoreSVG/2024/CoreSVG.xcframework; sourceTree = "<group>"; };
275751E32DEE1441003E467C /* TestingHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TestingHost.app; sourceTree = BUILT_PRODUCTS_DIR; };
279080912E8E5E7B0082B5B6 /* Testing.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Testing.framework; path = Platforms/MacOSX.platform/Developer/Library/Frameworks/Testing.framework; sourceTree = DEVELOPER_DIR; };
279283B92DFF11CE00234D64 /* OpenSwiftUIUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OpenSwiftUIUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -113,6 +118,7 @@
279FED0D2DF4567B00320390 /* OpenSwiftUI in Frameworks */,
27AF22B82E758F2E00D534AB /* BacklightServices.xcframework in Frameworks */,
27BB94442F5D5FE800B2AA0A /* Equatable in Frameworks */,
273F48CD2F6743D300F3379F /* CoreSVG.xcframework in Frameworks */,
27E28F112F5D5547007F8CF5 /* SFSymbols.xcframework in Frameworks */,
27AF22B42E758F2900D534AB /* CoreUI.xcframework in Frameworks */,
27AF22BC2E758F3700D534AB /* RenderBox.xcframework in Frameworks */,
Expand All @@ -127,6 +133,7 @@
2792849F2DFF137400234D64 /* SnapshotTesting in Frameworks */,
27AF22B92E758F2E00D534AB /* BacklightServices.xcframework in Frameworks */,
27BB94462F5D5FEE00B2AA0A /* Equatable in Frameworks */,
273F48D02F6743D900F3379F /* CoreSVG.xcframework in Frameworks */,
27E28F142F5D5556007F8CF5 /* SFSymbols.xcframework in Frameworks */,
27AF22B52E758F2900D534AB /* CoreUI.xcframework in Frameworks */,
27AF22BD2E758F3700D534AB /* RenderBox.xcframework in Frameworks */,
Expand All @@ -141,6 +148,7 @@
27AF22B22E758F2900D534AB /* CoreUI.xcframework in Frameworks */,
27AF22B62E758F2E00D534AB /* BacklightServices.xcframework in Frameworks */,
27E28F0B2F5D5531007F8CF5 /* SFSymbols.xcframework in Frameworks */,
273F46082F673F8F00F3379F /* CoreSVG.xcframework in Frameworks */,
27CD0B5F2AFC8DA7003665EB /* OpenSwiftUI in Frameworks */,
278EF52F2E227304009C32EB /* Equatable in Frameworks */,
27E6C4D32D2842740010502F /* AttributeGraph.xcframework in Frameworks */,
Expand All @@ -155,6 +163,7 @@
27AF22B32E758F2900D534AB /* CoreUI.xcframework in Frameworks */,
27AF22B72E758F2E00D534AB /* BacklightServices.xcframework in Frameworks */,
27E28F0E2F5D553F007F8CF5 /* SFSymbols.xcframework in Frameworks */,
273F48CA2F6743CC00F3379F /* CoreSVG.xcframework in Frameworks */,
27D49E0E2BA60AF600F6E2E2 /* OpenSwiftUI in Frameworks */,
278EF52D2E2272F2009C32EB /* Equatable in Frameworks */,
27186AE32D538A76009E05F9 /* AttributeGraph.xcframework in Frameworks */,
Expand Down Expand Up @@ -199,6 +208,7 @@
27D49E0C2BA60AF600F6E2E2 /* Frameworks */ = {
isa = PBXGroup;
children = (
273F46072F673F8F00F3379F /* CoreSVG.xcframework */,
27E28F0A2F5D5531007F8CF5 /* SFSymbols.xcframework */,
279080912E8E5E7B0082B5B6 /* Testing.framework */,
27AF22B12E758F0F00D534AB /* BacklightServices.xcframework */,
Expand Down
4 changes: 2 additions & 2 deletions Package.resolved

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

22 changes: 20 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ let renderBoxCondition = envBoolValue("RENDERBOX", default: buildForDarwinPlatfo
let anyAttributeFix = envBoolValue("ANY_ATTRIBUTE_FIX", default: !buildForDarwinPlatform)

let linkCoreUI = envBoolValue("LINK_COREUI", default: buildForDarwinPlatform && !isSPIBuild)
let linkCoreSVG = envBoolValue("LINK_CORESVG", default: buildForDarwinPlatform && !isSPIBuild)
let linkSFSymbols = envBoolValue("LINK_SFSYMBOLS", default: buildForDarwinPlatform && !isSPIBuild)
let linkBacklightServices = envBoolValue("LINK_BACKLIGHTSERVICES", default: buildForDarwinPlatform && !isSPIBuild)
// This should be disabled for UI test target due to link issue of Testing.
Expand Down Expand Up @@ -248,6 +249,12 @@ if linkCoreUI {
sharedSwiftSettings.append(.define("OPENSWIFTUI_LINK_COREUI"))
}

sharedCSettings.append(.define("OPENSWIFTUI_LINK_CORESVG", to: linkCoreSVG ? "1" : "0"))
sharedCxxSettings.append(.define("OPENSWIFTUI_LINK_CORESVG", to: linkCoreSVG ? "1" : "0"))
if linkCoreSVG {
sharedSwiftSettings.append(.define("OPENSWIFTUI_LINK_CORESVG"))
}

if linkSFSymbols {
sharedSwiftSettings.append(.define("OPENSWIFTUI_LINK_SFSYMBOLS"))
}
Expand Down Expand Up @@ -398,6 +405,12 @@ extension Target {
dependencies.append(.product(name: "CoreUI", package: "DarwinPrivateFrameworks"))
}

func addCoreSVGSettings() {
// FIXME: Weird SwiftPM behavior for test Target. Otherwize we'll get the following error message
// "could not determine executable path for bundle 'CoreSVG.framework'"
dependencies.append(.product(name: "CoreSVG", package: "DarwinPrivateFrameworks"))
}

func addSFSymbolsSettings() {
dependencies.append(.product(name: "SFSymbols", package: "DarwinPrivateFrameworks"))
}
Expand Down Expand Up @@ -849,6 +862,11 @@ if linkCoreUI {
openSwiftUISPITarget.addCoreUISettings()
}

if linkCoreSVG {
openSwiftUICoreTarget.addCoreSVGSettings()
openSwiftUISPITarget.addCoreSVGSettings()
}

if linkSFSymbols {
openSwiftUICoreTarget.addSFSymbolsSettings()
}
Expand All @@ -865,7 +883,7 @@ if useLocalDeps {
.package(path: "../OpenRenderBox"),
.package(path: "../OpenObservation"),
]
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkSFSymbols || linkBacklightServices {
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkCoreSVG || linkSFSymbols || linkBacklightServices {
dependencies.append(.package(path: "../DarwinPrivateFrameworks"))
}
package.dependencies += dependencies
Expand All @@ -877,7 +895,7 @@ if useLocalDeps {
.package(url: "https://github.com/OpenSwiftUIProject/OpenRenderBox", branch: "main"),
.package(url: "https://github.com/OpenSwiftUIProject/OpenObservation", branch: "main"),
]
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkSFSymbols {
if attributeGraphCondition || renderBoxCondition || linkCoreUI || linkCoreSVG || linkSFSymbols {
dependencies.append(.package(url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", branch: "main"))
}
package.dependencies += dependencies
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
//
// CGImageProvider.swift
// CGImageConversions.swift
// OpenSwiftUICore
//
// Audited for 6.5.4
// Status: Complete
// ID: BB7900A03A030BC988C08113497314C3 (SwiftUICore?)
// ID: BB7900A03A030BC988C08113497314C3 (SwiftUICore)

public import OpenCoreGraphicsShims
package import OpenSwiftUI_SPI

@available(OpenSwiftUI_v1_0, *)
extension Image {
Expand Down Expand Up @@ -106,4 +107,24 @@ extension CGImage {
_openSwiftUIPlatformUnimplementedFailure()
#endif
}

#if canImport(CoreGraphics)
private static let sRGB: CGColorSpace = CGColorSpace(name: CGColorSpace.sRGB)!

package static func context(_ pixelWidth: Int, _ pixelHeight: Int, prefersMask: Bool) -> CGContext? {
if prefersMask {
_CGBitmapContextCreate(
pixelWidth, pixelHeight,
nil,
CGImageAlphaInfo.alphaOnly.rawValue
)
} else {
_CGBitmapContextCreate(
pixelWidth, pixelHeight,
CGImage.sRGB,
CGBitmapInfo.byteOrder32Little.rawValue | CGImageAlphaInfo.premultipliedLast.rawValue
)
}
}
#endif
}
Loading
Loading