Skip to content

Commit

Permalink
image of the first selection is not appearing issue resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
malekwasim committed Sep 19, 2021
1 parent 33c85a3 commit a78c21c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions WMSegmentControl/Source/WMSegment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ open class WMSegment: UIControl {
}

if btn == sender {
if let imageSelected = imagesSelected[safe: buttonIndex] {
if let imageSelected = imagesSelected[safe: buttonIndex], !imageSelected.isEmpty {
btn.setImage(UIImage(named: imageSelected), for: .normal)
}
selectedSegmentIndex = buttonIndex
Expand Down Expand Up @@ -291,7 +291,7 @@ open class WMSegment: UIControl {
}

if btn.tag == index {
if let imageSelected = imagesSelected[safe: buttonIndex] {
if let imageSelected = imagesSelected[safe: buttonIndex], !imageSelected.isEmpty {
btn.setImage(UIImage(named: imageSelected), for: .normal)
}
selectedSegmentIndex = buttonIndex
Expand Down

0 comments on commit a78c21c

Please sign in to comment.