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

Commit

Permalink
KMMCalculator
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Jul 24, 2024
1 parent 3af551e commit 42d8ad9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Calcium/CalciumApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
// Copyright © 2024 Calcium. All rights reserved.
//

import CalciumCommon
import ComposableArchitecture
import Resolver
import SwiftUI

@main
struct CalciumApp: App {
init() {
Resolver.register { NativeCalculator() }
Resolver.register { KMMCalculator() }
.implements(Calculator.self)
}

Expand Down
6 changes: 6 additions & 0 deletions Calcium/Enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ struct NativeCalculator: Calculator {
}
}

extension KMMCalculator: Calculator {
func calculateValue(lhs: String, rhs: String, operation: Operation) -> String {
operation.calculateValueKMM(lhs: lhs, rhs: rhs).toPlainString()
}
}

extension CalciumCommon.Digit: CalciumCommon.CalculatorButtonRepresentable {
public var displayingValue: String {
String(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ sealed class CalculatorButton {
class SomeDigit(val digit: Digit) : CalculatorButton()
class SomeOperation(val operation: Operation) : CalculatorButton()
}

class KMMCalculator {}

0 comments on commit 42d8ad9

Please sign in to comment.