@@ -21,7 +21,7 @@ public protocol FSPagerViewDataSource: NSObjectProtocol {
2121
2222 /// Asks your data source object for the cell that corresponds to the specified item in the pager view.
2323 @objc ( pagerView: cellForItemAtIndex: )
24- func pagerView( _ pagerView: FSPagerView , cellForItemAt index: Int ) -> FSPagerViewBaseCell
24+ func pagerView( _ pagerView: FSPagerView , cellForItemAt index: Int ) -> UICollectionViewCell
2525
2626}
2727
@@ -46,11 +46,11 @@ public protocol FSPagerViewDelegate: NSObjectProtocol {
4646
4747 /// Tells the delegate that the specified cell is about to be displayed in the pager view.
4848 @objc ( pagerView: willDisplayCell: forItemAtIndex: )
49- optional func pagerView( _ pagerView: FSPagerView , willDisplay cell: FSPagerViewBaseCell , forItemAt index: Int )
49+ optional func pagerView( _ pagerView: FSPagerView , willDisplay cell: UICollectionViewCell , forItemAt index: Int )
5050
5151 /// Tells the delegate that the specified cell was removed from the pager view.
5252 @objc ( pagerView: didEndDisplayingCell: forItemAtIndex: )
53- optional func pagerView( _ pagerView: FSPagerView , didEndDisplaying cell: FSPagerViewBaseCell , forItemAt index: Int )
53+ optional func pagerView( _ pagerView: FSPagerView , didEndDisplaying cell: UICollectionViewCell , forItemAt index: Int )
5454
5555 /// Tells the delegate when the pager view is about to start scrolling the content.
5656 @objc ( pagerViewWillBeginDragging: )
@@ -379,15 +379,15 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
379379 return
380380 }
381381 let index = indexPath. item % self . numberOfItems
382- function ( self , cell as! FSPagerViewBaseCell , index)
382+ function ( self , cell, index)
383383 }
384384
385385 public func collectionView( _ collectionView: UICollectionView , didEndDisplaying cell: UICollectionViewCell , forItemAt indexPath: IndexPath ) {
386386 guard let function = self . delegate? . pagerView ( _: didEndDisplaying: forItemAt: ) else {
387387 return
388388 }
389389 let index = indexPath. item % self . numberOfItems
390- function ( self , cell as! FSPagerViewBaseCell , index)
390+ function ( self , cell, index)
391391 }
392392
393393 public func scrollViewDidScroll( _ scrollView: UIScrollView ) {
@@ -451,7 +451,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
451451 /// Register a nib file for use in creating new pager view cells.
452452 ///
453453 /// - Parameters:
454- /// - nib: The nib object containing the cell object. The nib file must contain only one top-level object and that object must be of the type FSPagerViewBaseCell .
454+ /// - nib: The nib object containing the cell object. The nib file must contain only one top-level object and that object must be of the type UICollectionViewCell .
455455 /// - identifier: The reuse identifier to associate with the specified nib file. This parameter must not be nil and must not be an empty string.
456456 @objc ( registerNib: forCellWithReuseIdentifier: )
457457 open func register( _ nib: UINib ? , forCellWithReuseIdentifier identifier: String ) {
@@ -463,15 +463,12 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
463463 /// - Parameters:
464464 /// - identifier: The reuse identifier for the specified cell. This parameter must not be nil.
465465 /// - index: The index specifying the location of the cell.
466- /// - Returns: A valid FSPagerViewBaseCell object.
466+ /// - Returns: A valid UICollectionViewCell object.
467467 @objc ( dequeueReusableCellWithReuseIdentifier: atIndex: )
468- open func dequeueReusableCell( withReuseIdentifier identifier: String , at index: Int ) -> FSPagerViewBaseCell {
468+ open func dequeueReusableCell( withReuseIdentifier identifier: String , at index: Int ) -> UICollectionViewCell {
469469 let indexPath = IndexPath ( item: index, section: self . dequeingSection)
470470 let cell = self . collectionView. dequeueReusableCell ( withReuseIdentifier: identifier, for: indexPath)
471- guard cell. isKind ( of: FSPagerViewBaseCell . self) else {
472- fatalError ( " Cell class must be subclass of FSPagerViewBaseCell " )
473- }
474- return cell as! FSPagerViewBaseCell
471+ return cell
475472 }
476473
477474 /// Reloads all of the data for the collection view.
@@ -532,7 +529,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
532529 /// - Parameter cell: The cell object whose index you want.
533530 /// - Returns: The index of the cell or NSNotFound if the specified cell is not in the pager view.
534531 @objc ( indexForCell: )
535- open func index( for cell: FSPagerViewBaseCell ) -> Int {
532+ open func index( for cell: UICollectionViewCell ) -> Int {
536533 guard let indexPath = self . collectionView. indexPath ( for: cell) else {
537534 return NSNotFound
538535 }
@@ -544,9 +541,9 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
544541 /// - Parameter index: The index that specifies the position of the cell.
545542 /// - Returns: The cell object at the corresponding position or nil if the cell is not visible or index is out of range.
546543 @objc ( cellForItemAtIndex: )
547- open func cellForItem( at index: Int ) -> FSPagerViewBaseCell ? {
544+ open func cellForItem( at index: Int ) -> UICollectionViewCell ? {
548545 let indexPath = self . nearbyIndexPath ( for: index)
549- return self . collectionView. cellForItem ( at: indexPath) as? FSPagerViewBaseCell
546+ return self . collectionView. cellForItem ( at: indexPath)
550547 }
551548
552549 // MARK: - Private functions
0 commit comments