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

Commit

Permalink
Format/Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanPodymov committed Jun 6, 2024
1 parent 4ee90ef commit ed2feb4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 32 deletions.
30 changes: 15 additions & 15 deletions Calcium/Enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ enum Operation {
extension Operation: CalculatorButtonRepresentable {
var displayingValue: String {
switch self {
case .plus:
return "+"
case .minus:
return "-"
case .multiply:
return "*"
case .divide:
return "/"
case .equals:
return "="
case .plus:
"+"
case .minus:
"-"
case .multiply:
"*"
case .divide:
"/"
case .equals:
"="
}
}
}
Expand All @@ -63,12 +63,12 @@ enum CalculatorButton {
extension CalculatorButton: CalculatorButtonRepresentable {
var displayingValue: String {
switch self {
case .digit(let value):
return value.displayingValue
case let .digit(value):
value.displayingValue
case .clear:
return "C"
case .operation(let operation):
return operation.displayingValue
"C"
case let .operation(operation):
operation.displayingValue
}
}
}
30 changes: 15 additions & 15 deletions Calcium/MainScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ struct MainScreen: View {
private func view(for calculatorButton: CalculatorButton) -> some View {
Button {
switch calculatorButton {
case .digit(let value):
displayingText += String(value.rawValue)
case .clear:
displayingText = ""
case .operation(let value):
case let .digit(value):
displayingText += String(value.rawValue)
case .clear:
displayingText = ""
case let .operation(value):
switch value {
case .plus:
onOperationButtonPressed(calculatorButton: calculatorButton)
Expand All @@ -37,16 +37,16 @@ struct MainScreen: View {
onOperationButtonPressed(calculatorButton: calculatorButton)
case .equals:
switch latestOperationButton {
case .operation(let operation) where operation == .minus:
displayingText = String(Int(leftValue)! - Int(displayingText)!)
case .operation(let operation) where operation == .plus:
displayingText = String(Int(leftValue)! + Int(displayingText)!)
case .operation(let operation) where operation == .multiply:
displayingText = String(Int(leftValue)! * Int(displayingText)!)
case .operation(let operation) where operation == .divide:
displayingText = String(Int(leftValue)! / Int(displayingText)!)
default:
break
case let .operation(operation) where operation == .minus:
displayingText = String(Int(leftValue)! - Int(displayingText)!)
case let .operation(operation) where operation == .plus:
displayingText = String(Int(leftValue)! + Int(displayingText)!)
case let .operation(operation) where operation == .multiply:
displayingText = String(Int(leftValue)! * Int(displayingText)!)
case let .operation(operation) where operation == .divide:
displayingText = String(Int(leftValue)! / Int(displayingText)!)
default:
break
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion CalciumTests/CalciumTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import XCTest

class CalciumTests: XCTestCase {
func test() { }
func test() {}
}
4 changes: 3 additions & 1 deletion Mintfile
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
yonaskolb/[email protected]
yonaskolb/[email protected]
realm/[email protected]
nicklockwood/[email protected]
10 changes: 10 additions & 0 deletions project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ targets:
sources: [Calcium]
info:
path: Calcium/Info.plist
postCompileScripts:
- script: "mint run swiftformat . --swiftversion 5.9"
name: SwiftFormat
- script: "mint run swiftlint"
name: SwiftLint
CalciumAppTests:
type: bundle.unit-test
platform: iOS
Expand All @@ -19,3 +24,8 @@ targets:
- target: CalciumApp
info:
path: CalciumTests/Info.plist
postCompileScripts:
- script: "mint run swiftformat . --swiftversion 5.9"
name: SwiftFormat
- script: "mint run swiftlint"
name: SwiftLint

0 comments on commit ed2feb4

Please sign in to comment.