UISwipesView Class Reference

Inherits from UIView
Declared in UISwipesView.h

Overview

The Swipes View is a new implementation of iOS’s CollectionView specifically made for 4 directional swiping. This implementation is loosely based upon Tinder’s Like/Nope Swiping action.

As in the example below, to pass data to the UISwipesView, the UISwipesViewDataSource needs to be implemented and passed to SwipesView dataSource.

 UISwipesView *swipesView = [[UISwipesView alloc] init];
 // Or from Storyboard Outlet (self.swipesView)

 swipesView.dataSource = someController;
 // Or Class that implements UISwipesViewDataSource

  dataSource

@property (nonatomic, assign) id<UISwipesViewDataSource> dataSource

  count

@property (nonatomic, assign) NSInteger count

– setAllowedDirections:

Sets the horizontal and vertical swiping directions enabled, and is automatically called when set in IB via the “direction_*” properties.

- (void)setAllowedDirections:(NSArray *)allowed

Discussion

Objective-C Usage Example:

UISwipesView *swipesView = [[UISwipesView alloc] init]; // Or from Storyboard Outlet (self.swipesView)

NSArray * directions = @[[Directions LEFT], [Directions RIGHT]]; // Or from Storyboard Options (Direction left, …)

[swipesView setAllowedDirections:directions];

Declared In

UISwipesView.h

– performSwipeLeft

The left swipe callback that performs the swipe operation.

- (void)performSwipeLeft

Declared In

UISwipesView.h

– performSwipeDown

The down swipe callback that performs the swipe operation.

- (void)performSwipeDown

Declared In

UISwipesView.h

– performSwipeRight

The right swipe callback that performs the swipe operation.

- (void)performSwipeRight

Declared In

UISwipesView.h

– performSwipeUp

The up swipe callback that performs the swipe operation.

- (void)performSwipeUp

Declared In

UISwipesView.h

+ addUISwipesViewDelegate:

The collection setter for Swipe Delegate changes.

This method (and the related collection) allows for multiple delegates for the swipes

+ (void)addUISwipesViewDelegate:(id<UISwipesViewDelegate>)newDelegate

Declared In

UISwipesView.h

+ removeUISwipesViewDelegate:

The collection unsetter for Swipe Delegate changes.

This method (and the related collection) allows for one less delegate for the swipes

+ (void)removeUISwipesViewDelegate:(id<UISwipesViewDelegate>)oldDelegate

Declared In

UISwipesView.h

– registerClass:forCellWithReuseIdentifier:

- (void)registerClass:(nullable Class)cellClass forCellWithReuseIdentifier:(NSString *)identifier

– reloadData

- (void)reloadData

– dequeueReusableCellWithReuseIdentifier:forIndexPath:

- (__kindof UISwipesViewCell *)dequeueReusableCellWithReuseIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath

– performBatchUpdates:completion:

- (void)performBatchUpdates:(void ( ^ __nullable ) ( void ))updates completion:(void ( ^ __nullable ) ( BOOL finished ))completion

– indexPathForItemAtPoint:

- (nullable NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point

– cellForItemAtIndexPath:

- (nullable UISwipesViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath

– insertItemsAtIndexPaths:

- (void)insertItemsAtIndexPaths:(NSArray<NSIndexPath*> *)indexPaths