Skip to content

Commit

Permalink
fix InlinePickerRowFormer bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ushisantoasobu committed Oct 16, 2018
1 parent 2dc7001 commit 4d5634f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Former/RowFormers/InlinePickerRowFormer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,12 @@ open class InlinePickerRowFormer<T: UITableViewCell, S>
if pickerItems.isEmpty {
displayLabel?.text = ""
} else {

// Sets selected row to 0 to avoid 'index out of range' error. This is in case the updated picker items array count
// is less than the prior array count.
selectedRow = 0

// Sets selected row to 0 to avoid 'index out of range' error. This is in case the updated picker items array count
// is less than the prior array count.
if pickerItems.count <= selectedRow {
selectedRow = 0
}

displayLabel?.text = pickerItems[selectedRow].title
_ = pickerItems[selectedRow].displayTitle.map { displayLabel?.attributedText = $0 }
Expand Down

0 comments on commit 4d5634f

Please sign in to comment.