2023-04-18 14:01:44 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2023-04-16 15:36:07 +00:00
|
|
|
//
|
2023-04-18 14:01:44 +00:00
|
|
|
// This source file is part of the SwiftLibs open source project
|
2023-04-16 15:36:07 +00:00
|
|
|
//
|
2023-04-18 14:01:44 +00:00
|
|
|
// Copyright (c) 2023 Röck+Cöde VoF. and the SwiftLibs project authors
|
|
|
|
// Licensed under the EUPL 1.2 or later.
|
2023-04-16 15:36:07 +00:00
|
|
|
//
|
2023-04-18 14:01:44 +00:00
|
|
|
// See LICENSE.txt for license information
|
|
|
|
// See CONTRIBUTORS.txt for the list of SwiftLibs project authors
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
2023-04-16 15:36:07 +00:00
|
|
|
|
2023-08-13 21:53:47 +00:00
|
|
|
import SwiftLibsDependency
|
2023-04-16 15:36:07 +00:00
|
|
|
|
|
|
|
// MARK: - Protocols
|
|
|
|
|
|
|
|
protocol TestService {}
|
|
|
|
|
|
|
|
// MARK: - Services
|
|
|
|
|
|
|
|
struct SomeService: TestService, Equatable {}
|
|
|
|
struct SomeOtherService: TestService, Equatable {}
|
|
|
|
|
|
|
|
// MARK: - DependencyKey
|
|
|
|
|
|
|
|
struct TestServiceKey: DependencyKey {
|
|
|
|
static var currentValue: TestService = SomeService()
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - DependencyService+Keys
|
|
|
|
|
|
|
|
extension DependencyService {
|
|
|
|
var testService: TestService {
|
|
|
|
get { Self[TestServiceKey.self] }
|
|
|
|
set { Self[TestServiceKey.self] = newValue }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|