Skip to content

Commit 204655e

Browse files
committed
chore: Rename Core to AstrojectCore
Add public init for Assembler
1 parent 1f8c40b commit 204655e

37 files changed

+744
-544
lines changed

Package.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ let package = Package(
1313
.visionOS(.v1)
1414
],
1515
products: [
16-
.library(name: "Astroject", targets: ["Core"]),
16+
.library(name: "Astroject", targets: ["AstrojectCore"]),
1717
.library(name: "Astroject-Nexus", targets: ["Nexus"]),
1818
.library(name: "Astroject-Singularity", targets: ["Singularity"])
1919
],
2020
dependencies: [
2121
.package(url: "https://github.com/realm/SwiftLint.git", from: "0.58.2") // Add SwiftLint as a development dependency
2222
],
2323
targets: [
24-
.target(name: "Core", plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
25-
.target(name: "Nexus", dependencies: ["Core"], plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
26-
.target(name: "Singularity", dependencies: ["Core"], plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
24+
.target(name: "AstrojectCore", plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
25+
.target(name: "Nexus", dependencies: ["AstrojectCore"], plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
26+
.target(name: "Singularity", dependencies: ["AstrojectCore"], plugins: [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]),
2727

28-
.testTarget(name: "CoreTests", dependencies: ["Core"]),
28+
.testTarget(name: "CoreTests", dependencies: ["AstrojectCore"]),
2929
.testTarget(name: "NexusTests", dependencies: ["Nexus"]),
3030
.testTarget(name: "SingularityTests", dependencies: ["Singularity"]),
3131
]
File renamed without changes.

Sources/Core/Assemble/Assembler.swift renamed to Sources/AstrojectCore/Assemble/Assembler.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,23 @@ import Foundation
1414
public class Assembler {
1515
/// The `Container` instance that dependencies are assembled into.
1616
let container: Container
17-
17+
1818
/// A `Resolver` instance that provides access to the assembled dependencies.
1919
/// This property returns the `Container` itself, as it conforms to the `Resolver` protocol.
2020
var resolver: Resolver { container }
2121

2222
/// Initializes an `Assembler` with a given `Container`.
2323
///
24-
/// - Parameter container: The `Container` instance to assemble dependencies into.
25-
init(container: Container) {
24+
/// - parameter container: The `Container` instance to assemble dependencies into.
25+
public init(container: Container) {
2626
self.container = container
2727
}
2828

2929
/// Applies a single `Assembly` to the `Container`.
3030
///
3131
/// This function applies the `assemble` and `loaded` methods of the provided `Assembly` instance.
3232
///
33-
/// - Parameter assembly: The `Assembly` instance to apply.
33+
/// - parameter assembly: The `Assembly` instance to apply.
3434
public func apply(assembly: Assembly) {
3535
run(assemblies: [assembly])
3636
}
@@ -39,7 +39,7 @@ public class Assembler {
3939
///
4040
/// This function applies the `assemble` and `loaded` methods of each `Assembly` instance in the provided array.
4141
///
42-
/// - Parameter assemblies: The array of `Assembly` instances to apply.
42+
/// - parameter assemblies: The array of `Assembly` instances to apply.
4343
public func apply(assemblies: [Assembly]) {
4444
run(assemblies: assemblies)
4545
}
@@ -51,7 +51,7 @@ public class Assembler {
5151
/// The `assemble` method registers dependencies in the `Container`,
5252
/// and the `loaded` method performs any post-registration setup.
5353
///
54-
/// - Parameter assemblies: The array of `Assembly` instances to run.
54+
/// - parameter assemblies: The array of `Assembly` instances to run.
5555
func run(assemblies: [Assembly]) {
5656
// Iterate through the assemblies and call the assemble method on each one to register the dependencies.
5757
assemblies.forEach { $0.assemble(container: container) }

Sources/Core/Assemble/Assembly.swift renamed to Sources/AstrojectCore/Assemble/Assembly.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public protocol Assembly {
1818
/// This function is called by an `Assembler` to register dependencies in the given `Container`.
1919
/// Implementations should use the `Container` to register factories and other configuration.
2020
///
21-
/// - Parameter container: The `Container` instance to configure.
21+
/// - parameter container: The `Container` instance to configure.
2222
func assemble(container: Container)
2323

2424
/// Called after the assembly has been loaded into the `Container`.
@@ -27,7 +27,7 @@ public protocol Assembly {
2727
/// It allows performing any post-registration setup or configuration that requires access to
2828
/// the resolved dependencies.
2929
///
30-
/// - Parameter resolver: The `Resolver` instance providing access to the assembled dependencies.
30+
/// - parameter resolver: The `Resolver` instance providing access to the assembled dependencies.
3131
func loaded(resolver: Resolver)
3232
}
3333

@@ -37,6 +37,6 @@ public extension Assembly {
3737
/// This default implementation is provided for convenience, allowing assemblies
3838
/// that do not require post-registration setup to omit implementing the `loaded` function.
3939
///
40-
/// - Parameter resolver: The `Resolver` instance (unused in the default implementation).
40+
/// - parameter resolver: The `Resolver` instance (unused in the default implementation).
4141
func loaded(resolver: Resolver) {}
4242
}

Sources/Core/AstrojectError.swift renamed to Sources/AstrojectCore/AstrojectError.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ public enum AstrojectError: LocalizedError {
8787
extension AstrojectError: Equatable {
8888
/// Checks if two `AstrojectError` instances are equal.
8989
///
90-
/// - Parameters:
91-
/// - lhs: The left-hand side `AstrojectError` instance.
92-
/// - rhs: The right-hand side `AstrojectError` instance.
90+
/// - parameter lhs: The left-hand side `AstrojectError` instance.
91+
/// - parameter rhs: The right-hand side `AstrojectError` instance.
9392
/// - Returns: `true` if the errors are equal, `false` otherwise.
9493
public static func == (lhs: AstrojectError, rhs: AstrojectError) -> Bool {
9594
switch (lhs, rhs) {

Sources/Core/Behavior.swift renamed to Sources/AstrojectCore/Behavior.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ import Foundation
1515
public protocol Behavior {
1616
/// Called after a registration has been added to the `Container`.
1717
///
18-
/// - Parameters:
19-
/// - type: The type of the product being registered.
20-
/// - container: The `Container` instance to which the registration was added.
21-
/// - registration: The `Registrable` instance that was added.
22-
/// - name: An optional name associated with the registration.
18+
/// - parameter type: The type of the product being registered.
19+
/// - parameter container: The `Container` instance to which the registration was added.
20+
/// - parameter registration: The `Registrable` instance that was added.
21+
/// - parameter name: An optional name associated with the registration.
2322
func didRegister<Product>(
2423
type: Product.Type,
2524
to container: Container,

0 commit comments

Comments
 (0)