Skip to content
This repository has been archived by the owner on Nov 3, 2024. It is now read-only.

Commit

Permalink
Fixing Xcode errors
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Nov 1, 2024
1 parent b1425f3 commit 507c743
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions Calcium/CalculatorClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,9 @@ import ComposableArchitecture
import Resolver

@DependencyClient
struct CalculatorClient: Sendable {
struct CalculatorClient: Sendable, DependencyKey, TestDependencyKey {
var calculateValue: @Sendable (String, String, CalciumCommon.Operation) -> String = { _, _, _ in "" }
}

extension DependencyValues {
var calculator: CalculatorClient {
get { self[CalculatorClient.self] }
set { self[CalculatorClient.self] = newValue }
}
}

/* extension CalculatorClient: DependencyKey {
static let liveValue = CalculatorClient(
calculateValue: {
/*@Injected var calculator: Calculator

return calculator.calculateValue(lhs: $0, rhs: $1, operation: $2)*/

// return ""
}
)
} */

extension CalculatorClient: TestDependencyKey {
static let previewValue = {
@Injected var calculator: Calculator

Expand All @@ -43,5 +22,20 @@ extension CalculatorClient: TestDependencyKey {
})
}()

static let liveValue = CalculatorClient(
calculateValue: {
@Injected var calculator: Calculator

return calculator.calculateValue(lhs: $0, rhs: $1, operation: $2)
}
)

static let testValue = previewValue
}

extension DependencyValues {
var calculator: CalculatorClient {
get { self[CalculatorClient.self] }
set { self[CalculatorClient.self] = newValue }
}
}

0 comments on commit 507c743

Please sign in to comment.