Skip to content

Commit

Permalink
#28 Started requiring individual items form the I3Draggable impl from…
Browse files Browse the repository at this point in the history
… the CGPoint instead of NSIndexPath.

Retrieving Cells from UI[Table | Collection]View s is easy with NSIndexPath, however one of the goals of 2.0.0 is to resolve #16. We need to decouple the coordination / rendering logic from the actual collection<->item types and impl

In the future, we should endevour to provide some sort of utility for mapping CGPoint to a cell so that users don't have to go around repeating allot of boilerplate code
  • Loading branch information
SteveFortune committed Sep 13, 2014
1 parent b4085ea commit 716fbe2
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions Pod/Classes/I3Draggable.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,35 @@
Protocol for 'draggables'. These represent a view that contain 'items' (subviews) which
can be dragged around.
@todo Right now, the implementation is repsonsable for mapping a CGPoint to a given item
in the collection so that the coordinator and the rendered aren't dependent on
`UITableView`/`UICollectionView`-specific point->index convertion methods. We need to
provide some sort of separate helper utility that allows users to do this easily without
having to implement the same boilerplate for all of their `UITableView`/
`UICollectionView`s.
@todo How do we enforce the constraint the items's are subviews of the collection view?
1.* didn't enforce this but I feel we should.
@todo Should all the methods returning instances, infact me readonly properties?
*/
@protocol I3Draggable <NSObject>

@required


/**
Returns YES or NO based on whether the item at a given index in the collection.
@name Rendering
@name Coordination
@param at The point at which the item is.
@return UIView * | nil if one does not exist
*/
-(BOOL) isItemRearrangeableAtPoint:(CGPoint) at;


/**
Returns the containing UIView that has is the superview of the 'items'. This can be
Expand All @@ -31,7 +51,8 @@
@name Rendering
@name Coordination
@return UIView
*/
-(UIView *)collection;

Expand All @@ -43,9 +64,11 @@
@name Rendering
@name Coordination
@param at The point at which the item is.
@return UIView * | nil if one does not exist
*/
-(UIView *)itemAtIndexPath:(NSIndexPath *)at;
-(UIView *)itemAtPoint:(CGPoint) at;


/**
Expand All @@ -55,9 +78,11 @@
'ghost' duplicate will appear to track around with the user's pan gesture.
@name Rendering
@param at The point at which the item is.
@return BOOL
*/
-(BOOL) hiddenItemWhileDragging;
-(BOOL) hideWhileDraggingItemAtPoint:(CGPoint) at;


@optional
Expand All @@ -72,7 +97,8 @@
properties of the view that being used by the rendered?
@warning This is not implemented yet
@name Rendering
@param draggingView The view to apply styling to.
*/
-(void) applyStylingToDraggingView:(UIView *)draggingView;

Expand Down

0 comments on commit 716fbe2

Please sign in to comment.