@@ -21,7 +21,7 @@ public protocol FSPagerViewDataSource: NSObjectProtocol {
21
21
22
22
/// Asks your data source object for the cell that corresponds to the specified item in the pager view.
23
23
@objc ( pagerView: cellForItemAtIndex: )
24
- func pagerView( _ pagerView: FSPagerView , cellForItemAt index: Int ) -> FSPagerViewBaseCell
24
+ func pagerView( _ pagerView: FSPagerView , cellForItemAt index: Int ) -> UICollectionViewCell
25
25
26
26
}
27
27
@@ -46,11 +46,11 @@ public protocol FSPagerViewDelegate: NSObjectProtocol {
46
46
47
47
/// Tells the delegate that the specified cell is about to be displayed in the pager view.
48
48
@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 )
50
50
51
51
/// Tells the delegate that the specified cell was removed from the pager view.
52
52
@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 )
54
54
55
55
/// Tells the delegate when the pager view is about to start scrolling the content.
56
56
@objc ( pagerViewWillBeginDragging: )
@@ -379,15 +379,15 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
379
379
return
380
380
}
381
381
let index = indexPath. item % self . numberOfItems
382
- function ( self , cell as! FSPagerViewBaseCell , index)
382
+ function ( self , cell, index)
383
383
}
384
384
385
385
public func collectionView( _ collectionView: UICollectionView , didEndDisplaying cell: UICollectionViewCell , forItemAt indexPath: IndexPath ) {
386
386
guard let function = self . delegate? . pagerView ( _: didEndDisplaying: forItemAt: ) else {
387
387
return
388
388
}
389
389
let index = indexPath. item % self . numberOfItems
390
- function ( self , cell as! FSPagerViewBaseCell , index)
390
+ function ( self , cell, index)
391
391
}
392
392
393
393
public func scrollViewDidScroll( _ scrollView: UIScrollView ) {
@@ -451,7 +451,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
451
451
/// Register a nib file for use in creating new pager view cells.
452
452
///
453
453
/// - 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 .
455
455
/// - identifier: The reuse identifier to associate with the specified nib file. This parameter must not be nil and must not be an empty string.
456
456
@objc ( registerNib: forCellWithReuseIdentifier: )
457
457
open func register( _ nib: UINib ? , forCellWithReuseIdentifier identifier: String ) {
@@ -463,15 +463,12 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
463
463
/// - Parameters:
464
464
/// - identifier: The reuse identifier for the specified cell. This parameter must not be nil.
465
465
/// - index: The index specifying the location of the cell.
466
- /// - Returns: A valid FSPagerViewBaseCell object.
466
+ /// - Returns: A valid UICollectionViewCell object.
467
467
@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 {
469
469
let indexPath = IndexPath ( item: index, section: self . dequeingSection)
470
470
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
475
472
}
476
473
477
474
/// Reloads all of the data for the collection view.
@@ -532,7 +529,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
532
529
/// - Parameter cell: The cell object whose index you want.
533
530
/// - Returns: The index of the cell or NSNotFound if the specified cell is not in the pager view.
534
531
@objc ( indexForCell: )
535
- open func index( for cell: FSPagerViewBaseCell ) -> Int {
532
+ open func index( for cell: UICollectionViewCell ) -> Int {
536
533
guard let indexPath = self . collectionView. indexPath ( for: cell) else {
537
534
return NSNotFound
538
535
}
@@ -544,9 +541,9 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega
544
541
/// - Parameter index: The index that specifies the position of the cell.
545
542
/// - Returns: The cell object at the corresponding position or nil if the cell is not visible or index is out of range.
546
543
@objc ( cellForItemAtIndex: )
547
- open func cellForItem( at index: Int ) -> FSPagerViewBaseCell ? {
544
+ open func cellForItem( at index: Int ) -> UICollectionViewCell ? {
548
545
let indexPath = self . nearbyIndexPath ( for: index)
549
- return self . collectionView. cellForItem ( at: indexPath) as? FSPagerViewBaseCell
546
+ return self . collectionView. cellForItem ( at: indexPath)
550
547
}
551
548
552
549
// MARK: - Private functions
0 commit comments