diff --git a/Calcium/Enums.swift b/Calcium/Enums.swift index 0c1b598..335e463 100644 --- a/Calcium/Enums.swift +++ b/Calcium/Enums.swift @@ -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: + "=" } } } @@ -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 } } } diff --git a/Calcium/MainScreen.swift b/Calcium/MainScreen.swift index 0485561..c6e5c09 100644 --- a/Calcium/MainScreen.swift +++ b/Calcium/MainScreen.swift @@ -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) @@ -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 } } } diff --git a/CalciumTests/CalciumTests.swift b/CalciumTests/CalciumTests.swift index dc1eb48..fe98bf9 100644 --- a/CalciumTests/CalciumTests.swift +++ b/CalciumTests/CalciumTests.swift @@ -9,5 +9,5 @@ import XCTest class CalciumTests: XCTestCase { - func test() { } + func test() {} } diff --git a/Mintfile b/Mintfile index f63e20b..97e97d1 100644 --- a/Mintfile +++ b/Mintfile @@ -1 +1,3 @@ -yonaskolb/xcodegen@2.41.0 \ No newline at end of file +yonaskolb/xcodegen@2.41.0 +realm/swiftlint@0.55.1 +nicklockwood/swiftformat@0.53.10 \ No newline at end of file diff --git a/project.yml b/project.yml index 930623a..3b561e0 100644 --- a/project.yml +++ b/project.yml @@ -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 @@ -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