Skip to content

Commit 55c9fbb

Browse files
authored
Fix code warning (#2)
1 parent 837667d commit 55c9fbb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

iOSDropDown/Classes/iOSDropDown.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,10 @@ open class DropDown : UITextField{
224224
table.backgroundColor = rowBackgroundColor
225225
table.rowHeight = rowHeight
226226
if scrollToSelectedIndex{
227-
if selectedIndex != nil{
228-
if let indexPath = NSIndexPath(row: selectedIndex!, section: 0) as? IndexPath{
229-
self.table.scrollToRow(at: indexPath, at: .top, animated: true)
230-
self.table.reloadData()
231-
}
227+
if let selectedIndex = selectedIndex {
228+
let indexPath = IndexPath(row: selectedIndex, section: 0)
229+
self.table.scrollToRow(at: indexPath, at: .top, animated: true)
230+
self.table.reloadData()
232231
}
233232
}
234233
parentController?.view.addSubview(shadow)

0 commit comments

Comments
 (0)