Skip to content

Commit

Permalink
Replace selectedIndex type from NSNumber to NSUInteger to backward co…
Browse files Browse the repository at this point in the history
…mpatibility
  • Loading branch information
Danila Gusev committed Dec 4, 2017
1 parent fa56a85 commit 908b56a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion EHHorizontalSelectionView/EHHorizontalSelectionView.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ IB_DESIGNABLE
/*!
* @brief returns selected index
*/
- (NSNumber * _Nullable)selectedIndex;
- (NSUInteger)selectedIndex;

/*!
* @brief returns selection view data
Expand Down
8 changes: 4 additions & 4 deletions EHHorizontalSelectionView/EHHorizontalSelectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ - (EHHorizontalViewCell * _Nonnull)dequeueReusableCellWithReuseIdentifier:(NSStr
return [self.collectionView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
}

- (NSNumber * _Nullable)selectedIndex
- (NSUInteger)selectedIndex
{
if (!_selectedIndexPath)
if (!_selectedIndexPath || _selectedIndexPath.row < 0)
{
return NULL;
return NSNotFound;
}

return [[NSNumber alloc]initWithUnsignedLong:_selectedIndexPath.row];
return (NSUInteger)_selectedIndexPath.row;
}

- (void)selectIndex:(NSUInteger)index
Expand Down

0 comments on commit 908b56a

Please sign in to comment.