-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
160 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Sources/DFService/DFError.swift → Sources/DFService/CommonError.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
public protocol DFHandler { | ||
associatedtype Input | ||
associatedtype Output = Void | ||
|
||
func handleSync(_ input: Input) throws -> Output | ||
func handle(_ input: Input) async throws-> Output | ||
} | ||
|
||
public extension DFHandler { | ||
func handle(_ input: Input) async throws -> Output { | ||
return try self.handleSync(input) | ||
} | ||
} | ||
|
||
|
||
public struct AnyHandler<Input,Output>: DFHandler { | ||
public func handleSync(_ input: Input) throws -> Output { | ||
return try _handlerSync(input) | ||
} | ||
public func handle(_ input: Input) async throws -> Output { | ||
return try await _handler(input) | ||
} | ||
|
||
private let _handlerSync:(Input) throws -> Output | ||
private let _handler:(Input) async throws -> Output | ||
public init<T: DFHandler>(_ handler: T) where T.Input == Input, T.Output == Output { | ||
self._handler = handler.handle(_:) | ||
self._handlerSync = handler.handleSync(_:) | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import SwiftUI | ||
public protocol DFServiceKey { | ||
associatedtype Value | ||
static var defaultValue: Self.Value { get } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,3 @@ | ||
public struct AppService: DFApiService { | ||
public static var defaultValue: Value { | ||
return Value.shared | ||
} | ||
} | ||
|
||
extension AppService { | ||
open class Value: DFApplication, ObservableObject { | ||
|
||
internal static var shared = Value() | ||
public init() {} | ||
public var providerType: [ServiceProvider.Type] { | ||
do { | ||
let provider = try Bundle.main.app.loadClass(ofType: ServiceProvider.self, named: "AppServiceProvider") | ||
return [provider] | ||
} catch { | ||
return [] | ||
} | ||
} | ||
|
||
public var loadProviders: [ServiceProvider] = [] | ||
|
||
@Published | ||
public var rootView: AnyView = AnyView(RouterView()) | ||
} | ||
public struct AppService: DFServiceKey { | ||
public static var defaultValue = Application.shared | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.