From 70e8c067ff5e63e7968ebae6ea35890e9e523ca1 Mon Sep 17 00:00:00 2001 From: Sahil Saini Date: Tue, 11 Apr 2023 12:45:29 +0530 Subject: [PATCH] [Issue] started working on images --- Sources/YStepper/UIKit/StepperControl+Appearance.swift | 6 +++--- Sources/YStepper/UIKit/StepperControl.swift | 2 ++ Tests/YStepperTests/Classes/StepperControlTests.swift | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Sources/YStepper/UIKit/StepperControl+Appearance.swift b/Sources/YStepper/UIKit/StepperControl+Appearance.swift index 71dad45..57f9865 100644 --- a/Sources/YStepper/UIKit/StepperControl+Appearance.swift +++ b/Sources/YStepper/UIKit/StepperControl+Appearance.swift @@ -77,9 +77,9 @@ extension StepperControl.Appearance { /// Default stepper appearance public static let `default` = StepperControl.Appearance() /// Default image for delete button. Is a `trash` from SF Symbols in template rendering mode. - public static let defaultDeleteImage = StepperControl.Images.delete.image.withRenderingMode(.alwaysTemplate) + public static let defaultDeleteImage = StepperControl.Images.delete.image /// Default image for increment button. Is a `plus` from SF Symbols in template rendering mode. - public static let defaultIncrementImage = StepperControl.Images.increment.image.withRenderingMode(.alwaysTemplate) + public static let defaultIncrementImage = StepperControl.Images.increment.image /// Default image for decrement button. Is a `minus` from SF Symbols in template rendering mode. - public static let defaultDecrementImage = StepperControl.Images.decrement.image.withRenderingMode(.alwaysTemplate) + public static let defaultDecrementImage = StepperControl.Images.decrement.image } diff --git a/Sources/YStepper/UIKit/StepperControl.swift b/Sources/YStepper/UIKit/StepperControl.swift index d6599da..da61f39 100644 --- a/Sources/YStepper/UIKit/StepperControl.swift +++ b/Sources/YStepper/UIKit/StepperControl.swift @@ -87,6 +87,8 @@ extension StepperControl { case increment = "plus" case decrement = "minus" case delete = "trash" + + public static var renderingMode: UIImage.RenderingMode { .alwaysTemplate } } } diff --git a/Tests/YStepperTests/Classes/StepperControlTests.swift b/Tests/YStepperTests/Classes/StepperControlTests.swift index dcb1693..37276ab 100644 --- a/Tests/YStepperTests/Classes/StepperControlTests.swift +++ b/Tests/YStepperTests/Classes/StepperControlTests.swift @@ -29,6 +29,12 @@ final class StepperControlTests: XCTestCase { XCTAssertEqual(sut.appearance.incrementImage, defaultAppearance.incrementImage) } + func test_renderMode_deliversCorrectMode() { + StepperControl.Images.allCases.forEach { + XCTAssertEqual($0.image.renderingMode, .alwaysTemplate) + } + } + func testCustomeAppearance() { let customeAppearance = StepperControl.Appearance(textStyle: (textColor: .red, typography: .systemButton)) let sut = makeSUT(appearance: customeAppearance)