Skip to content

Commit

Permalink
[Issue] started working on images (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
SahilSainiYML authored Apr 13, 2023
1 parent 37dff06 commit 25fce44
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/YStepper/UIKit/StepperControl+Appearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions Sources/YStepper/UIKit/StepperControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ extension StepperControl {
case increment = "plus"
case decrement = "minus"
case delete = "trash"

public static var renderingMode: UIImage.RenderingMode { .alwaysTemplate }
}
}

Expand Down
6 changes: 6 additions & 0 deletions Tests/YStepperTests/Classes/StepperControlTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 25fce44

Please sign in to comment.