Skip to content

Commit

Permalink
new release
Browse files Browse the repository at this point in the history
  • Loading branch information
zhxnlai committed Dec 10, 2014
1 parent c40cc9e commit 206e32a
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 9 deletions.
8 changes: 5 additions & 3 deletions README.md
@@ -1,6 +1,6 @@
ZLSwipeableView
===============
A simple view for building card like interface like [Tinder](http://www.gotinder.com/) and [Potluck](https://www.potluck.it/).
A simple view for building card like interface like [Tinder](http://www.gotinder.com/) and [Potluck](https://www.potluck.it/). ZLSwipeableView was originally developed for [Murmur](http://zhxnlai.github.io/#/murmur).

Preview
---
Expand Down Expand Up @@ -79,9 +79,11 @@ Requirements
- iOS 7 or higher.
- Automatic Reference Counting (ARC).

Contributions
Credits
---
- Thanks [iamphill](https://github.com/iamphill) for adding new delegates
- Thanks [iamphill](https://github.com/iamphill) for adding new delegates.
- Thanks [mdznr](https://github.com/mdznr) for making the code style consistent.
- Thanks [coryalder](https://github.com/coryalder) for making dataSource and delegate IBOutlets.

License
---
Expand Down
4 changes: 2 additions & 2 deletions ZLSwipeableView.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "ZLSwipeableView"
s.version = "0.0.5"
s.version = "0.0.6"
s.summary = "A simple view for building card like interface like Tinder and Potluck."
s.description = <<-DESC
ZLSwipeableView is a simple view for building card like interface like Tinder and Potluck. It uses dataSource pattern and is highly customizable.
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Zhixuan Lai" => "zhxnlai@gmail.com" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/zhxnlai/ZLSwipeableView.git", :tag => "0.0.5" }
s.source = { :git => "https://github.com/zhxnlai/ZLSwipeableView.git", :tag => "0.0.6" }
s.source_files = "ZLSwipeableView", "ZLSwipeableView/**/*.{h,m}"
# s.exclude_files = "Classes/Exclude"
s.framework = "UIKit"
Expand Down
13 changes: 13 additions & 0 deletions ZLSwipeableView/ZLPanGestureRecognizer.h
@@ -0,0 +1,13 @@
//
// ZLPanGestureRecognizer.h
// ZLSwipeableViewDemo
//
// Created by Zhixuan Lai on 12/9/14.
// Copyright (c) 2014 Zhixuan Lai. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface ZLPanGestureRecognizer : UIPanGestureRecognizer

@end
13 changes: 13 additions & 0 deletions ZLSwipeableView/ZLPanGestureRecognizer.m
@@ -0,0 +1,13 @@
//
// ZLPanGestureRecognizer.m
// ZLSwipeableViewDemo
//
// Created by Zhixuan Lai on 12/9/14.
// Copyright (c) 2014 Zhixuan Lai. All rights reserved.
//

#import "ZLPanGestureRecognizer.h"

@implementation ZLPanGestureRecognizer

@end
14 changes: 10 additions & 4 deletions ZLSwipeableView/ZLSwipeableView.m
Expand Up @@ -7,8 +7,9 @@
//

#import "ZLSwipeableView.h"
#import "ZLPanGestureRecognizer.h"

static const int numPrefetchedViews = 3;
const NSUInteger kNumPrefetchedViews = 3;

@interface ZLSwipeableView () <UICollisionBehaviorDelegate, UIDynamicAnimatorDelegate>

Expand Down Expand Up @@ -111,7 +112,7 @@ - (void)loadNextSwipeableViewsIfNeeded {
- (void)loadNextSwipeableViewsIfNeeded:(BOOL)animated {
NSInteger numViews = self.containerView.subviews.count;
NSMutableSet *newViews = [NSMutableSet set];
for (NSInteger i=numViews; i<numPrefetchedViews; i++) {
for (NSInteger i=numViews; i<kNumPrefetchedViews; i++) {
UIView *nextView = [self nextSwipeableView];
if (nextView) {
[self.containerView addSubview:nextView];
Expand All @@ -123,7 +124,7 @@ - (void)loadNextSwipeableViewsIfNeeded:(BOOL)animated {

if (animated) {
NSTimeInterval maxDelay = 0.3;
NSTimeInterval delayStep = maxDelay/numPrefetchedViews;
NSTimeInterval delayStep = maxDelay/kNumPrefetchedViews;
NSTimeInterval aggregatedDelay = maxDelay;
NSTimeInterval animationDuration = 0.25;
for (UIView *view in newViews) {
Expand Down Expand Up @@ -388,6 +389,11 @@ - (void)collisionBehavior:(UICollisionBehavior *)behavior endedContactForItem:(i
}

for (UIView *view in viewsToRemove) {
for (UIGestureRecognizer *aGestureRecognizer in view.gestureRecognizers) {
if ([aGestureRecognizer isKindOfClass:[ZLPanGestureRecognizer class]]) {
[view removeGestureRecognizer:aGestureRecognizer];
}
}
[view removeFromSuperview];
}
}
Expand Down Expand Up @@ -421,7 +427,7 @@ - (UIView *)nextSwipeableView {
nextView = [self.dataSource nextViewForSwipeableView:self];
}
if (nextView) {
[nextView addGestureRecognizer:[[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]];
[nextView addGestureRecognizer:[[ZLPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)]];
}
return nextView;
}
Expand Down
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
0901414B1A37FF7900435455 /* ZLPanGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 0901414A1A37FF7900435455 /* ZLPanGestureRecognizer.m */; };
092F0F341A05B474007CDDCC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 092F0F331A05B474007CDDCC /* main.m */; };
092F0F371A05B474007CDDCC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 092F0F361A05B474007CDDCC /* AppDelegate.m */; };
092F0F3A1A05B474007CDDCC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 092F0F391A05B474007CDDCC /* ViewController.m */; };
Expand All @@ -30,6 +31,8 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
090141491A37FF7900435455 /* ZLPanGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZLPanGestureRecognizer.h; sourceTree = "<group>"; };
0901414A1A37FF7900435455 /* ZLPanGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZLPanGestureRecognizer.m; sourceTree = "<group>"; };
092F0F2E1A05B474007CDDCC /* ZLSwipeableViewDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZLSwipeableViewDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
092F0F321A05B474007CDDCC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
092F0F331A05B474007CDDCC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -144,6 +147,8 @@
0971D45B1A08425E00325B8D /* ZLSwipeableView */ = {
isa = PBXGroup;
children = (
090141491A37FF7900435455 /* ZLPanGestureRecognizer.h */,
0901414A1A37FF7900435455 /* ZLPanGestureRecognizer.m */,
0971D45E1A08425E00325B8D /* ZLSwipeableView.h */,
0971D45F1A08425E00325B8D /* ZLSwipeableView.m */,
);
Expand Down Expand Up @@ -254,6 +259,7 @@
092F0F3A1A05B474007CDDCC /* ViewController.m in Sources */,
092F0F661A05C9CA007CDDCC /* UIColor+FlatColors.m in Sources */,
092F0F371A05B474007CDDCC /* AppDelegate.m in Sources */,
0901414B1A37FF7900435455 /* ZLPanGestureRecognizer.m in Sources */,
092F0F341A05B474007CDDCC /* main.m in Sources */,
092F0F691A05DAF9007CDDCC /* CardView.m in Sources */,
0971D4611A08425E00325B8D /* ZLSwipeableView.m in Sources */,
Expand Down

0 comments on commit 206e32a

Please sign in to comment.