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
3 changes: 2 additions & 1 deletion Documentation/Manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ This manual provides a detailed guide to using SafeDI effectively in your Swift

## Macros

There are a total of four macros in the SafeDI library:
There are a total of five macros in the SafeDI library:

| Macro | Decorating | Usage |
| ------ | ---------- | ----- |
| [`@Instantiable`](#instantiable) | Type or extension declaration | Makes a type capable of being instantiated by SafeDI. |
| [`@Instantiated`](#instantiated) | Property declaration | Instantiates an instance or value when the enclosing `@Instantiable`-decorated type is instantiated. |
| [`@Forwarded`](#forwarded) | Property declaration | Propagates a runtime-created instance or value (e.g. a `User` object, network response, or customer input) down the dependency tree. |
| [`@Received`](#received) | Property declaration | Receives an instance or value from an `@Instantiated` or `@Forwarded` property further up the dependency tree. |
| [`@SafeDIConfiguration`](#configuration) | Enum declaration | Provides build-time configuration for SafeDI’s code generation plugin. |

Let’s walk through each of these macros in detail.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ struct MigrateSafeDIFromVersionOne: CommandPlugin {
\t/// Directories containing Swift files to include, relative to the executing directory.
\t/// This property only applies to SafeDI repos that utilize the SPM plugin via an Xcode project.
\tstatic let additionalDirectoriesToInclude: [StaticString] = \(directoriesToIncludeArray)

\t/// Whether to generate `mock()` methods for `@Instantiable` types.
\tstatic let generateMocks: Bool = true

\t/// The conditional compilation flag to wrap generated mock code in.
\t/// Set to `nil` to generate mocks without conditional compilation.
\tstatic let mockConditionalCompilation: StaticString? = "DEBUG"
}
"""
}
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ dependencies: [
]
```

> **Note:** SafeDI 2.x requires Swift 6.3 or later. Projects using an earlier Swift version should use SafeDI 1.x.

To install the SafeDI framework into an Xcode project with Swift Package Manager, follow [Apple’s instructions](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app) to add `https://github.com/dfed/SafeDI.git` as a dependency.

Expand Down Expand Up @@ -168,7 +167,9 @@ Other Swift DI libraries, like [Factory](https://github.com/hmlongco/Factory) an

## Migrating from SafeDI 1.x to 2.x

SafeDI 2.x requires Swift 6.3 or later and removes support for CSV-based configuration files (`.safedi/configuration/include.csv` and `.safedi/configuration/additionalImportedModules.csv`). Configuration is now done via the `@SafeDIConfiguration` macro.
SafeDI 2.x requires Swift 6.3 or later and does not support CocoaPods. Projects using an earlier Swift version or CocoaPods should use SafeDI 1.x.

SafeDI 2.x also removes support for CSV-based configuration files (`.safedi/configuration/include.csv` and `.safedi/configuration/additionalImportedModules.csv`). Configuration is now done via the `@SafeDIConfiguration` macro.

### Automated migration

Expand Down
15 changes: 14 additions & 1 deletion Sources/SafeDICore/Models/TypeDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,20 @@ public enum TypeDescription: Codable, Hashable, Comparable, Sendable {
} else {
return type
}
default:
case .any,
.array,
.closure,
.composition,
.dictionary,
.implicitlyUnwrappedOptional,
.metatype,
.nested,
.optional,
.simple,
.some,
.tuple,
.unknown,
.void:
return self
}
}
Expand Down
Loading