Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Add nullability annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
tflhyl committed Oct 18, 2017
1 parent fe567fb commit c8b3e80
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 4 additions & 0 deletions SSPullToRefresh/SSPullToRefreshDefaultContentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

#import "SSPullToRefreshView.h"

NS_ASSUME_NONNULL_BEGIN

@interface SSPullToRefreshDefaultContentView : UIView <SSPullToRefreshContentView>

@property (nonatomic, readonly) UILabel *statusLabel;
@property (nonatomic, readonly) UILabel *lastUpdatedAtLabel;
@property (nonatomic, readonly) UIActivityIndicatorView *activityIndicatorView;

@end

NS_ASSUME_NONNULL_END
4 changes: 4 additions & 0 deletions SSPullToRefresh/SSPullToRefreshSimpleContentView.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@

#import "SSPullToRefreshView.h"

NS_ASSUME_NONNULL_BEGIN

@interface SSPullToRefreshSimpleContentView : UIView <SSPullToRefreshContentView>

@property (nonatomic, readonly) UILabel *statusLabel;
@property (nonatomic, readonly) UIActivityIndicatorView *activityIndicatorView;

@end

NS_ASSUME_NONNULL_END
12 changes: 8 additions & 4 deletions SSPullToRefresh/SSPullToRefreshView.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) {
@protocol SSPullToRefreshViewDelegate;
@protocol SSPullToRefreshContentView;

NS_ASSUME_NONNULL_BEGIN

@interface SSPullToRefreshView : UIView

/**
Expand Down Expand Up @@ -105,15 +107,15 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) {
@see initWithScrollView:delegate:
*/
@property (nonatomic, assign, readonly) UIScrollView *scrollView;
@property (nonatomic, weak, readonly, nullable) UIScrollView *scrollView;

/**
The delegate is sent messages when the pull to refresh view starts loading. This is automatically set with `initWithScrollView:delegate:`.
@see initWithScrollView:delegate:
@see SSPullToRefreshViewDelegate
*/
@property (nonatomic, weak) id<SSPullToRefreshViewDelegate> delegate;
@property (nonatomic, weak, nullable) id<SSPullToRefreshViewDelegate> delegate;

/**
The state of the pull to refresh view.
Expand Down Expand Up @@ -156,13 +158,13 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) {
animate down the pull to refresh view to show that it's loading.
*/
- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated;
- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(void(^)())block;
- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(nullable void(^)(void))block;

/**
Call this when you finish loading.
*/
- (void)finishLoading;
- (void)finishLoadingAnimated:(BOOL)animated completion:(void(^)())block;
- (void)finishLoadingAnimated:(BOOL)animated completion:(nullable void(^)(void))block;

/**
Manually update the last updated at time. This will automatically get called when the pull to refresh view finishes laoding.
Expand Down Expand Up @@ -240,3 +242,5 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) {
- (void)setLastUpdatedAt:(NSDate *)date withPullToRefreshView:(SSPullToRefreshView *)view;

@end

NS_ASSUME_NONNULL_END
4 changes: 2 additions & 2 deletions SSPullToRefresh/SSPullToRefreshView.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ - (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated {
[self startLoadingAndExpand:shouldExpand animated:animated completion:nil];
}

- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(void(^)())block {
- (void)startLoadingAndExpand:(BOOL)shouldExpand animated:(BOOL)animated completion:(void(^)(void))block {
// If we're not loading, this method has no effect
if (self.state == SSPullToRefreshViewStateLoading) {
return;
Expand All @@ -209,7 +209,7 @@ - (void)finishLoading {
[self finishLoadingAnimated:YES completion:nil];
}

- (void)finishLoadingAnimated:(BOOL)animated completion:(void(^)())block {
- (void)finishLoadingAnimated:(BOOL)animated completion:(void(^)(void))block {
// If we're not loading, this method has no effect
if (self.state != SSPullToRefreshViewStateLoading) {
return;
Expand Down

0 comments on commit c8b3e80

Please sign in to comment.