Skip to content

Commit

Permalink
Merge pull request samvermette#127 from hborders/typesafe_enum_and_an…
Browse files Browse the repository at this point in the history
…alyzer

Use new typesafe enum macro. Run analyzer.
  • Loading branch information
samvermette committed Sep 26, 2013
2 parents 28691b7 + a0d347e commit 98a713c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Demo/SVPullToRefreshDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
};
name = Debug;
Expand All @@ -278,6 +279,7 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down
8 changes: 2 additions & 6 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@

@interface UIScrollView (SVPullToRefresh)

enum {
typedef NS_ENUM(NSUInteger, SVPullToRefreshPosition) {
SVPullToRefreshPositionTop = 0,
SVPullToRefreshPositionBottom,
};

typedef NSUInteger SVPullToRefreshPosition;

- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler;
- (void)addPullToRefreshWithActionHandler:(void (^)(void))actionHandler position:(SVPullToRefreshPosition)position;
- (void)triggerPullToRefresh;
Expand All @@ -32,15 +30,13 @@ typedef NSUInteger SVPullToRefreshPosition;
@end


enum {
typedef NS_ENUM(NSUInteger, SVPullToRefreshState) {
SVPullToRefreshStateStopped = 0,
SVPullToRefreshStateTriggered,
SVPullToRefreshStateLoading,
SVPullToRefreshStateAll = 10
};

typedef NSUInteger SVPullToRefreshState;

@interface SVPullToRefreshView : UIView

@property (nonatomic, strong) UIColor *arrowColor;
Expand Down
2 changes: 2 additions & 0 deletions SVPullToRefresh/UIScrollView+SVPullToRefresh.m
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ - (void)layoutSubviews {
}
else {
switch (self.state) {
case SVPullToRefreshStateAll:
case SVPullToRefreshStateStopped:
self.arrow.alpha = 1;
[self.activityIndicatorView stopAnimating];
Expand Down Expand Up @@ -640,6 +641,7 @@ - (void)setState:(SVPullToRefreshState)newState {
[self layoutIfNeeded];

switch (newState) {
case SVPullToRefreshStateAll:
case SVPullToRefreshStateStopped:
[self resetScrollViewContentInset];
break;
Expand Down

0 comments on commit 98a713c

Please sign in to comment.