From d8ddd288838669aee41e75a840e2df6d93cb36ba Mon Sep 17 00:00:00 2001 From: Theodore Felix Leo Date: Wed, 18 Oct 2017 16:59:17 +0800 Subject: [PATCH 1/2] Add nullability annotations --- SSPullToRefresh/SSPullToRefreshDefaultContentView.h | 4 ++++ SSPullToRefresh/SSPullToRefreshSimpleContentView.h | 4 ++++ SSPullToRefresh/SSPullToRefreshView.h | 12 ++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/SSPullToRefresh/SSPullToRefreshDefaultContentView.h b/SSPullToRefresh/SSPullToRefreshDefaultContentView.h index 13c1894..c5dede9 100644 --- a/SSPullToRefresh/SSPullToRefreshDefaultContentView.h +++ b/SSPullToRefresh/SSPullToRefreshDefaultContentView.h @@ -8,6 +8,8 @@ #import "SSPullToRefreshView.h" +NS_ASSUME_NONNULL_BEGIN + @interface SSPullToRefreshDefaultContentView : UIView @property (nonatomic, readonly) UILabel *statusLabel; @@ -15,3 +17,5 @@ @property (nonatomic, readonly) UIActivityIndicatorView *activityIndicatorView; @end + +NS_ASSUME_NONNULL_END diff --git a/SSPullToRefresh/SSPullToRefreshSimpleContentView.h b/SSPullToRefresh/SSPullToRefreshSimpleContentView.h index e0e8924..085eade 100644 --- a/SSPullToRefresh/SSPullToRefreshSimpleContentView.h +++ b/SSPullToRefresh/SSPullToRefreshSimpleContentView.h @@ -8,9 +8,13 @@ #import "SSPullToRefreshView.h" +NS_ASSUME_NONNULL_BEGIN + @interface SSPullToRefreshSimpleContentView : UIView @property (nonatomic, readonly) UILabel *statusLabel; @property (nonatomic, readonly) UIActivityIndicatorView *activityIndicatorView; @end + +NS_ASSUME_NONNULL_END diff --git a/SSPullToRefresh/SSPullToRefreshView.h b/SSPullToRefresh/SSPullToRefreshView.h index 94e8449..b5110e2 100644 --- a/SSPullToRefresh/SSPullToRefreshView.h +++ b/SSPullToRefresh/SSPullToRefreshView.h @@ -66,6 +66,8 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) { @protocol SSPullToRefreshViewDelegate; @protocol SSPullToRefreshContentView; +NS_ASSUME_NONNULL_BEGIN + @interface SSPullToRefreshView : UIView /** @@ -105,7 +107,7 @@ 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:`. @@ -113,7 +115,7 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) { @see initWithScrollView:delegate: @see SSPullToRefreshViewDelegate */ -@property (nonatomic, weak) id delegate; +@property (nonatomic, weak, nullable) id delegate; /** The state of the pull to refresh view. @@ -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(^)(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(^)(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. @@ -240,3 +242,5 @@ typedef NS_ENUM(NSUInteger, SSPullToRefreshViewStyle) { - (void)setLastUpdatedAt:(NSDate *)date withPullToRefreshView:(SSPullToRefreshView *)view; @end + +NS_ASSUME_NONNULL_END From ce20d8ca3e95504a89119c0b9e54752136572419 Mon Sep 17 00:00:00 2001 From: Theodore Felix Leo Date: Fri, 18 May 2018 18:15:19 +0800 Subject: [PATCH 2/2] Revert back to unsafe_unretained --- SSPullToRefresh/SSPullToRefreshView.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SSPullToRefresh/SSPullToRefreshView.h b/SSPullToRefresh/SSPullToRefreshView.h index b5110e2..14dcb9f 100644 --- a/SSPullToRefresh/SSPullToRefreshView.h +++ b/SSPullToRefresh/SSPullToRefreshView.h @@ -107,7 +107,7 @@ NS_ASSUME_NONNULL_BEGIN @see initWithScrollView:delegate: */ -@property (nonatomic, weak, readonly, nullable) UIScrollView *scrollView; +@property (nonatomic, unsafe_unretained, readonly, nullable) UIScrollView *scrollView; /** The delegate is sent messages when the pull to refresh view starts loading. This is automatically set with `initWithScrollView:delegate:`.