This PR contains the work done to provide a simple dependency injection feature whenever required. To provide further details about this work: - [x] renamed the `Coordinator` target in the `Package` file as `Coordination`; - [x] declared the `Dependencies` target in the `Package` file; - [x] defined the `DependencyKey` public protocol; - [x] implemented the `DependencyService` public service; - [x] implemented the `Dependency` public property wrapper; Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: #3
70 lines
1.4 KiB
Swift
70 lines
1.4 KiB
Swift
// swift-tools-version: 5.8
|
|
|
|
import PackageDescription
|
|
|
|
private var excludePlatforms: [String] = [.PlatformFolder.iOS]
|
|
|
|
#if os(iOS)
|
|
excludePlatforms = []
|
|
#endif
|
|
|
|
let package = Package(
|
|
name: "SwiftLibs",
|
|
products: [
|
|
.library(
|
|
name: "SwiftLibs",
|
|
targets: [
|
|
"Coordination",
|
|
"Core",
|
|
"Dependencies"
|
|
]
|
|
),
|
|
],
|
|
dependencies: [],
|
|
targets: [
|
|
.target(
|
|
name: "Coordination",
|
|
dependencies: [],
|
|
exclude: excludePlatforms
|
|
),
|
|
.target(
|
|
name: "Core",
|
|
dependencies: []
|
|
),
|
|
.target(
|
|
name: "Dependencies",
|
|
dependencies: []
|
|
),
|
|
.testTarget(
|
|
name: "CoordinationTests",
|
|
dependencies: [
|
|
"Coordination"
|
|
],
|
|
path: "Tests/Coordination",
|
|
exclude: excludePlatforms
|
|
),
|
|
.testTarget(
|
|
name: "CoreTests",
|
|
dependencies: [
|
|
"Core"
|
|
],
|
|
path: "Tests/Core"
|
|
),
|
|
.testTarget(
|
|
name: "DependenciesTests",
|
|
dependencies: [
|
|
"Dependencies"
|
|
],
|
|
path: "Tests/Dependencies"
|
|
),
|
|
]
|
|
)
|
|
|
|
// MARK: - String+Constants
|
|
|
|
private extension String {
|
|
enum PlatformFolder {
|
|
static let iOS = "Platform/iOS"
|
|
}
|
|
}
|