deep-linking-sample/Apps/Locations/Sources/Extensions/DependencyService+Keys.swift

47 lines
1.0 KiB
Swift
Raw Normal View History

//
// DependencyService+Keys.swift
// Locations
//
// Created by Javier Cicchelli on 11/04/2023.
// Copyright © 2023 Röck+Cöde. All rights reserved.
//
import Core
import Dependency
import Persistence
import Remote
import UIKit
// MARK: - DependencyService+Keys
extension DependencyService {
var app: Core.Application {
get { Self[ApplicationKey.self] }
set { Self[ApplicationKey.self] = newValue }
}
var persistence: Persistence.Service {
get { Self[PersistenceKey.self] }
set { Self[PersistenceKey.self] = newValue }
}
var remote: Remote.Service {
get { Self[RemoteKey.self] }
set { Self[RemoteKey.self] = newValue }
}
}
// MARK: - Dependency keys
struct ApplicationKey: DependencyKey {
static var currentValue: Core.Application = UIApplication.shared
}
struct PersistenceKey: DependencyKey {
static var currentValue: Persistence.Service = PersistenceService.shared
}
struct RemoteKey: DependencyKey {
static var currentValue: Remote.Service = RemoteService()
}