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

Commit

Permalink
Not crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Nov 1, 2024
1 parent 507c743 commit 2c69d07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Calcium/CalciumApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 5 additions & 6 deletions Calcium/CalculatorClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
)

Expand Down

0 comments on commit 2c69d07

Please sign in to comment.