From 2c69d075122f3cf5770cd984c970f0e76e85a5aa Mon Sep 17 00:00:00 2001 From: Roman Podymov Date: Fri, 1 Nov 2024 15:49:36 +0100 Subject: [PATCH] Not crashing --- Calcium/CalciumApp.swift | 5 +++-- Calcium/CalculatorClient.swift | 11 +++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Calcium/CalciumApp.swift b/Calcium/CalciumApp.swift index 6ddc9b7..1ef02ec 100644 --- a/Calcium/CalciumApp.swift +++ b/Calcium/CalciumApp.swift @@ -8,14 +8,15 @@ import CalciumCommon import ComposableArchitecture + import Resolver import SwiftUI @main struct CalciumApp: App { init() { - Resolver.register { NativeCalculator() } - .implements(Calculator.self) + // Resolver.register { NativeCalculator() } + // .implements(Calculator.self) } var body: some Scene { diff --git a/Calcium/CalculatorClient.swift b/Calcium/CalculatorClient.swift index 47c3370..4ace18e 100644 --- a/Calcium/CalculatorClient.swift +++ b/Calcium/CalculatorClient.swift @@ -8,25 +8,24 @@ import CalciumCommon import ComposableArchitecture + import Resolver @DependencyClient struct CalculatorClient: Sendable, DependencyKey, TestDependencyKey { var calculateValue: @Sendable (String, String, CalciumCommon.Operation) -> String = { _, _, _ in "" } - static let previewValue = { - @Injected var calculator: Calculator + static let previewValue = // @Injected var calculator: Calculator - return Self(calculateValue: { + Self(calculateValue: { NativeCalculator().calculateValue(lhs: $0, rhs: $1, operation: $2) }) - }() static let liveValue = CalculatorClient( calculateValue: { - @Injected var calculator: Calculator + // @Injected var calculator: Calculator - return calculator.calculateValue(lhs: $0, rhs: $1, operation: $2) + NativeCalculator().calculateValue(lhs: $0, rhs: $1, operation: $2) } )