This PR contains the work on implementing some public interfaces that were forgotten during the development of this app and, of course, improves the text of the README file a bit more. To give further details about the work done: - [x] implemented the `Service` protocol in the `Persistence` library and conformed the `PersistenceService` service to it; - [x] implemented the `Service` protocol in the `Remote` library and conformed the `RemoteService` service to it; - [x] implemented the `Application` protocol in the `Core` library and conformed the `UIApplication` class to it; - [x] improved the dependency keys used by the `DependencyService` service to use these protocols instead; - [x] tweaked the text of the README file. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#14
47 lines
1.0 KiB
Swift
47 lines
1.0 KiB
Swift
//
|
|
// 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()
|
|
}
|