diff --git a/Sources/Spezi/Module/ModuleCollection.swift b/Sources/Spezi/Module/ModuleCollection.swift index 79b2ba26..a273daea 100644 --- a/Sources/Spezi/Module/ModuleCollection.swift +++ b/Sources/Spezi/Module/ModuleCollection.swift @@ -11,8 +11,10 @@ /// /// You can not create a ``ModuleCollection`` yourself. Please use the ``ModuleBuilder`` to create a ``ModuleCollection``. public class ModuleCollection { - let elements: [any Module] - + /// The elements of the collection. + @_spi(Spezi) + public let elements: [any Module] + init(elements: [any Module]) { self.elements = elements diff --git a/Sources/Spezi/Spezi/KnowledgeSources/LaunchOptionsKey.swift b/Sources/Spezi/Spezi/KnowledgeSources/LaunchOptionsKey.swift index bd823142..b1db01f1 100644 --- a/Sources/Spezi/Spezi/KnowledgeSources/LaunchOptionsKey.swift +++ b/Sources/Spezi/Spezi/KnowledgeSources/LaunchOptionsKey.swift @@ -9,21 +9,21 @@ import SpeziFoundation import SwiftUI - -struct LaunchOptionsKey: DefaultProvidingKnowledgeSource { - typealias Anchor = SpeziAnchor +@_spi(Spezi) +public struct LaunchOptionsKey: DefaultProvidingKnowledgeSource { + public typealias Anchor = SpeziAnchor #if os(iOS) || os(visionOS) || os(tvOS) - typealias Value = [UIApplication.LaunchOptionsKey: Any] + public typealias Value = [UIApplication.LaunchOptionsKey: Any] #elseif os(macOS) /// Currently not supported as ``SpeziAppDelegate/applicationWillFinishLaunching(_:)`` on macOS /// is executed after the initialization of ``Spezi`` via `View/spezi(_:)` is done, breaking our initialization assumption in ``SpeziAppDelegate/applicationWillFinishLaunching(_:)``. - typealias Value = [Never: Any] + public typealias Value = [Never: Any] #else // os(watchOS) - typealias Value = [Never: Any] + public typealias Value = [Never: Any] #endif - static let defaultValue: Value = [:] + public static let defaultValue: Value = [:] } diff --git a/Sources/Spezi/Spezi/Spezi.swift b/Sources/Spezi/Spezi/Spezi.swift index cd17ee1a..62ac8afe 100644 --- a/Sources/Spezi/Spezi/Spezi.swift +++ b/Sources/Spezi/Spezi/Spezi.swift @@ -91,7 +91,8 @@ public class Spezi { ) - var lifecycleHandler: [LifecycleHandler] { + @_spi(Spezi) + public var lifecycleHandler: [LifecycleHandler] { storage.collect(allOf: LifecycleHandler.self) } @@ -108,7 +109,15 @@ public class Spezi { self.init(standard: configuration.standard, modules: configuration.modules.elements, storage: storage) } - init( + + /// Create a new Spezi instance. + /// + /// - Parameters: + /// - standard: The standard to use. + /// - modules: The collection of modules to initialize. + /// - storage: Optional, initial storage to inject. + @_spi(Spezi) + public init( standard: any Standard, modules: [any Module], storage: consuming SpeziStorage = SpeziStorage() diff --git a/Sources/Spezi/Standard/DefaultStandard.swift b/Sources/Spezi/Standard/DefaultStandard.swift index 87036912..5ead5990 100644 --- a/Sources/Spezi/Standard/DefaultStandard.swift +++ b/Sources/Spezi/Standard/DefaultStandard.swift @@ -7,4 +7,7 @@ // -actor DefaultStandard: Standard {} +@_spi(Spezi) +public actor DefaultStandard: Standard { + public init() {} +} diff --git a/Sources/XCTSpezi/DependencyResolution.swift b/Sources/XCTSpezi/DependencyResolution.swift index a2a4efb4..8cda4a18 100644 --- a/Sources/XCTSpezi/DependencyResolution.swift +++ b/Sources/XCTSpezi/DependencyResolution.swift @@ -6,8 +6,8 @@ // SPDX-License-Identifier: MIT // -@testable import Spezi -@_implementationOnly import SwiftUI +@_spi(Spezi) import Spezi +import SwiftUI /// Configure and resolve the dependency tree for a collection of [`Module`](https://swiftpackageindex.com/stanfordspezi/spezi/documentation/spezi/module)s. diff --git a/Tests/SpeziTests/ModuleTests/ModuleBuilderTests.swift b/Tests/SpeziTests/ModuleTests/ModuleBuilderTests.swift index 3db5dab3..c6284b02 100644 --- a/Tests/SpeziTests/ModuleTests/ModuleBuilderTests.swift +++ b/Tests/SpeziTests/ModuleTests/ModuleBuilderTests.swift @@ -6,7 +6,7 @@ // SPDX-License-Identifier: MIT // -@testable import Spezi +@testable @_spi(Spezi) import Spezi import XCTest import XCTRuntimeAssertions