diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 393f978..f53456e 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -8,9 +8,14 @@ on: jobs: test: - runs-on: macos-11 + runs-on: macos-latest steps: + - name: Install Swift + uses: slashmo/install-swift@v0.4.0 + with: + version: "5.9" + - name: Get Sources uses: actions/checkout@v2 diff --git a/Sources/DIContainer/Container.swift b/Sources/DIContainer/Container.swift index 9cb7f41..15c5f6b 100644 --- a/Sources/DIContainer/Container.swift +++ b/Sources/DIContainer/Container.swift @@ -11,7 +11,8 @@ public class Container: Injectable { /// A dictionary holding the dependencies. /// - /// The dependencies are stored as key-value pairs where the key is any hashable object and the value is the dependency. + /// The dependencies are stored as key-value pairs where the key + /// is any hashable object and the value is the dependency. public var dependencies: [AnyHashable: Any] = [:] /// Creates a new instance of `Container`. @@ -22,7 +23,9 @@ public class Container: Injectable { /// A property wrapper for injecting dependencies. /// -/// This struct wraps a property and injects a dependency into it. If the dependency cannot be resolved and no default value is provided, it will crash the application. +/// This struct wraps a property and injects a dependency into it. +/// If the dependency cannot be resolved and no default value is provided, +/// it will crash the application. @propertyWrapper public struct Injected { /// Error types related to dependency injection. @@ -51,7 +54,9 @@ public class Container: Injectable { /// The resolved value of the dependency. /// - /// This property lazily resolves the dependency. If the dependency cannot be resolved, it will use the provided default value. If both fail, the application will crash. + /// This property lazily resolves the dependency. + /// If the dependency cannot be resolved, it will use the provided default value. + /// If both fail, the application will crash. public lazy var wrappedValue: Value = { if let value = try? container.resolve(identifier) { return value @@ -67,7 +72,8 @@ public class Container: Injectable { /// A property wrapper for safely injecting dependencies. /// -/// This struct wraps a property and injects an optional dependency into it. If the dependency cannot be resolved, the property will be nil. +/// This struct wraps a property and injects an optional dependency into it. +/// If the dependency cannot be resolved, the property will be nil. @propertyWrapper public struct InjectedSafe { /// Returns the standard container used for resolving dependencies. @@ -88,6 +94,7 @@ public class Container: Injectable { /// The optionally resolved value of the dependency. /// - /// This property lazily tries to resolve the dependency. If the dependency cannot be resolved, the property will be nil. + /// This property lazily tries to resolve the dependency. + /// If the dependency cannot be resolved, the property will be nil. public lazy var wrappedValue: Value? = try? container.resolve(identifier) } diff --git a/Sources/DIContainer/DIContainer.swift b/Sources/DIContainer/DIContainer.swift index 647fe45..16be6c0 100644 --- a/Sources/DIContainer/DIContainer.swift +++ b/Sources/DIContainer/DIContainer.swift @@ -11,7 +11,8 @@ public protocol Resolvable { func resolve(_ identifier: InjectIdentifier) throws -> Value } -/// An enumeration representing errors that can occur during the resolution of dependencies. +/// An enumeration representing errors +/// that can occur during the resolution of dependencies. public enum ResolvableError: Error { /// Indicates that a dependency could not be found. @@ -22,7 +23,8 @@ public enum ResolvableError: Error { case dependencyNotFound(Any.Type?, String?) } -/// Extension to make `ResolvableError` conform to `LocalizedError`, providing a localized description of the error. +/// Extension to make `ResolvableError` conform +/// to `LocalizedError`, providing a localized description of the error. extension ResolvableError: LocalizedError { /// A localized description of the error.