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
8 changes: 8 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ if internalXRSDK {
sharedSwiftSettings.append(.define("OPENSWIFTUI_INTERNAL_XR_SDK"))
}

// MARK: - [env] OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS

let enablePrivateImports = envEnable("OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS", default: true)
if enablePrivateImports {
sharedSwiftSettings.append(.define("OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS"))
sharedSwiftSettings.append(.unsafeFlags(["-Xfrontend", "-enable-private-imports"]))
}

// MARK: - OpenSwiftUISPI Target

let openSwiftUISPITarget = Target.target(
Expand Down
6 changes: 3 additions & 3 deletions Sources/OpenSwiftUICore/Data/Location/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ extension AnyLocation: Sendable {}
// MARK: - LocationBox

final package class LocationBox<L>: AnyLocation<L.Value>, Location, @unchecked Sendable where L: Location {
final internal(set) package var location: L
final private(set) package var location: L

@AtomicBox
var cache = LocationProjectionCache()
private var cache = LocationProjectionCache()

package init(_ location: L) {
self.location = location
Expand Down
10 changes: 8 additions & 2 deletions Tests/OpenSwiftUICoreTests/Data/Location/LocationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
// LocationTests.swift
// OpenSwiftUICoreTests

@_spi(ForOpenSwiftUIOnly) import OpenSwiftUICore
@testable import OpenSwiftUICore
@_spi(ForOpenSwiftUIOnly)
@testable
#if OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS
@_private(sourceFile: "Location.swift")
#endif
import OpenSwiftUICore
import Testing

struct LocationTests {
Expand Down Expand Up @@ -63,6 +67,7 @@ struct LocationTests {
#expect(location.get() == 1)
}

#if OPENSWIFTUI_ENABLE_PRIVATE_IMPORTS
@Test
func boxProjectingAndCache() {
struct V {
Expand Down Expand Up @@ -101,4 +106,5 @@ struct LocationTests {
box.cache.reset()
#expect(box.cache.cache.isEmpty == true)
}
#endif
}