From 6b7556d173fb988630fb5024f282d476b75fbfef Mon Sep 17 00:00:00 2001 From: Danny Zlobinsky Date: Mon, 7 Dec 2015 16:02:58 -0500 Subject: [PATCH 1/3] Add missing nullability annotations --- Pod/Classes/ios/NYTPhotoCaptionView.h | 6 +++++- .../ios/NYTPhotoDismissalInteractionController.h | 6 +++++- Pod/Classes/ios/NYTPhotoTransitionAnimator.h | 10 +++++++--- Pod/Classes/ios/NYTPhotoTransitionController.h | 4 ++++ Pod/Classes/ios/NYTPhotoViewController.h | 10 +++++++--- Pod/Classes/ios/NYTPhotosDataSource.h | 6 +++++- Pod/Classes/ios/NYTScalingImageView.h | 6 +++++- Pod/Classes/ios/Protocols/NYTPhoto.h | 4 ++++ 8 files changed, 42 insertions(+), 10 deletions(-) diff --git a/Pod/Classes/ios/NYTPhotoCaptionView.h b/Pod/Classes/ios/NYTPhotoCaptionView.h index beb27ec4..3e7d61ef 100644 --- a/Pod/Classes/ios/NYTPhotoCaptionView.h +++ b/Pod/Classes/ios/NYTPhotoCaptionView.h @@ -8,6 +8,8 @@ @import UIKit; +NS_ASSUME_NONNULL_BEGIN + /** * The left and right margin around the content. */ @@ -27,6 +29,8 @@ extern const CGFloat NYTPhotoCaptionViewHorizontalMargin; * * @return A fully initialized object. */ -- (instancetype)initWithAttributedTitle:(NSAttributedString *)attributedTitle attributedSummary:(NSAttributedString *)attributedSummary attributedCredit:(NSAttributedString *)attributedCredit NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithAttributedTitle:(nullable NSAttributedString *)attributedTitle attributedSummary:(nullable NSAttributedString *)attributedSummary attributedCredit:(nullable NSAttributedString *)attributedCredit NS_DESIGNATED_INITIALIZER; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/ios/NYTPhotoDismissalInteractionController.h b/Pod/Classes/ios/NYTPhotoDismissalInteractionController.h index 5902e186..0029f987 100644 --- a/Pod/Classes/ios/NYTPhotoDismissalInteractionController.h +++ b/Pod/Classes/ios/NYTPhotoDismissalInteractionController.h @@ -8,6 +8,8 @@ @import UIKit; +NS_ASSUME_NONNULL_BEGIN + /** * An object that controls an interactive photo dismissal transition. */ @@ -21,7 +23,7 @@ /** * If set, this view will be hidden as soon as the interactive transition starts, and shown after it ends. */ -@property (nonatomic) UIView *viewToHideWhenBeginningTransition; +@property (nonatomic, nullable) UIView *viewToHideWhenBeginningTransition; /** * A `BOOL` determining whether, after reaching a certain panning threshold that constitutes a dismissal, the animator object should be used to finish the transition. @@ -38,3 +40,5 @@ - (void)didPanWithPanGestureRecognizer:(UIPanGestureRecognizer *)panGestureRecognizer viewToPan:(UIView *)viewToPan anchorPoint:(CGPoint)anchorPoint; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pod/Classes/ios/NYTPhotoTransitionAnimator.h b/Pod/Classes/ios/NYTPhotoTransitionAnimator.h index 925ecb6a..dc946554 100644 --- a/Pod/Classes/ios/NYTPhotoTransitionAnimator.h +++ b/Pod/Classes/ios/NYTPhotoTransitionAnimator.h @@ -8,6 +8,8 @@ @import UIKit; +NS_ASSUME_NONNULL_BEGIN + /** * An object that controls the animated transition of photo presentation and dismissal. */ @@ -26,12 +28,12 @@ /** * The view that is used for animating the starting view. If no view is set, the starting view is screenshotted and the relevant properties are copied to the new view. */ -@property (nonatomic) UIView *startingViewForAnimation; +@property (nonatomic, nullable) UIView *startingViewForAnimation; /** * The view that is used for animating the ending view. If no view is set, the ending view is screenshotted and relevant properties copied to the new view. */ -@property (nonatomic) UIView *endingViewForAnimation; +@property (nonatomic, nullable) UIView *endingViewForAnimation; /** * Whether this transition is a dismissal. If `NO`, presentation is assumed. @@ -75,6 +77,8 @@ * * @return A new view identical in appearance to the passed-in view, with relevant properties transferred. Not a member of any view hierarchy. Return `nil` if the passed-in view is `nil`. */ -+ (UIView *)newAnimationViewFromView:(UIView *)view; ++ (nullable UIView *)newAnimationViewFromView:(nullable UIView *)view; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/ios/NYTPhotoTransitionController.h b/Pod/Classes/ios/NYTPhotoTransitionController.h index 03fdf989..68b5d2c8 100644 --- a/Pod/Classes/ios/NYTPhotoTransitionController.h +++ b/Pod/Classes/ios/NYTPhotoTransitionController.h @@ -8,6 +8,8 @@ @import UIKit; +NS_ASSUME_NONNULL_BEGIN + /** * An object that manages both animated transitions and interactive transitions, acting as the transitioning delegate and internally coordinating multiple objects that do the animating and interactivity work. */ @@ -38,3 +40,5 @@ - (void)didPanWithPanGestureRecognizer:(UIPanGestureRecognizer *)panGestureRecognizer viewToPan:(UIView *)viewToPan anchorPoint:(CGPoint)anchorPoint; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pod/Classes/ios/NYTPhotoViewController.h b/Pod/Classes/ios/NYTPhotoViewController.h index af355fb9..e883b8a5 100644 --- a/Pod/Classes/ios/NYTPhotoViewController.h +++ b/Pod/Classes/ios/NYTPhotoViewController.h @@ -14,6 +14,8 @@ @protocol NYTPhoto; @protocol NYTPhotoViewControllerDelegate; +NS_ASSUME_NONNULL_BEGIN + /** * `NYTPhotoViewController` observes this notification. It expects an `id ` object as the object of the notification. */ @@ -32,7 +34,7 @@ extern NSString * const NYTPhotoViewControllerPhotoImageUpdatedNotification; /** * The internal activity view shown while the image is loading. Set from the initializer. */ -@property (nonatomic, readonly) UIView *loadingView; +@property (nonatomic, readonly, nullable) UIView *loadingView; /** * The gesture recognizer used to detect the double tap gesture used for zooming on photos. @@ -42,7 +44,7 @@ extern NSString * const NYTPhotoViewControllerPhotoImageUpdatedNotification; /** * The object that acts as the photo view controller's delegate. */ -@property (nonatomic, weak) id delegate; +@property (nonatomic, weak, nullable) id delegate; /** * The designated initializer that takes the photo and activity view. @@ -53,7 +55,7 @@ extern NSString * const NYTPhotoViewControllerPhotoImageUpdatedNotification; * * @return A fully initialized object. */ -- (instancetype)initWithPhoto:(id )photo loadingView:(UIView *)loadingView notificationCenter:(NSNotificationCenter *)notificationCenter NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithPhoto:(nullable id )photo loadingView:(nullable UIView *)loadingView notificationCenter:(nullable NSNotificationCenter *)notificationCenter NS_DESIGNATED_INITIALIZER; @end @@ -70,3 +72,5 @@ extern NSString * const NYTPhotoViewControllerPhotoImageUpdatedNotification; - (void)photoViewController:(NYTPhotoViewController *)photoViewController didLongPressWithGestureRecognizer:(UILongPressGestureRecognizer *)longPressGestureRecognizer; @end + +NS_ASSUME_NONNULL_END \ No newline at end of file diff --git a/Pod/Classes/ios/NYTPhotosDataSource.h b/Pod/Classes/ios/NYTPhotosDataSource.h index 289dcd69..053f30bc 100644 --- a/Pod/Classes/ios/NYTPhotosDataSource.h +++ b/Pod/Classes/ios/NYTPhotosDataSource.h @@ -10,6 +10,8 @@ #import "NYTPhotosViewControllerDataSource.h" +NS_ASSUME_NONNULL_BEGIN + /** * A concrete implementation of the `NYTPhotosViewControllerDataSource`. */ @@ -22,6 +24,8 @@ * * @return A fully initialized object. */ -- (instancetype)initWithPhotos:(NSArray *)photos NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithPhotos:(nullable NSArray *)photos NS_DESIGNATED_INITIALIZER; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/ios/NYTScalingImageView.h b/Pod/Classes/ios/NYTScalingImageView.h index 1d1496bc..37d1a90d 100644 --- a/Pod/Classes/ios/NYTScalingImageView.h +++ b/Pod/Classes/ios/NYTScalingImageView.h @@ -12,6 +12,8 @@ @class FLAnimatedImageView; #endif +NS_ASSUME_NONNULL_BEGIN + @interface NYTScalingImageView : UIScrollView /** @@ -31,7 +33,7 @@ * * @return A fully initialized object. */ -- (instancetype)initWithImageData:(NSData *)image frame:(CGRect)frame NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithImageData:(nullable NSData *)image frame:(CGRect)frame NS_DESIGNATED_INITIALIZER; /** * Updates the image in the image view and centers and zooms the new image. @@ -46,3 +48,5 @@ - (void)centerScrollViewContents; @end + +NS_ASSUME_NONNULL_END diff --git a/Pod/Classes/ios/Protocols/NYTPhoto.h b/Pod/Classes/ios/Protocols/NYTPhoto.h index 559c4e0a..2a329f1e 100644 --- a/Pod/Classes/ios/Protocols/NYTPhoto.h +++ b/Pod/Classes/ios/Protocols/NYTPhoto.h @@ -8,6 +8,8 @@ @import UIKit; +NS_ASSUME_NONNULL_BEGIN + /** * The model for photos displayed in an `NYTPhotosViewController`. */ @@ -45,3 +47,5 @@ @property (nonatomic, readonly, nullable) NSAttributedString *attributedCaptionCredit; @end + +NS_ASSUME_NONNULL_END From 1d5c692ef988aea4114a27efe7dbb9d5a5d5f3a7 Mon Sep 17 00:00:00 2001 From: Danny Zlobinsky Date: Mon, 4 Jan 2016 10:53:32 -0500 Subject: [PATCH 2/3] Add missing newline at EOF in NYTPhotoViewController --- Pod/Classes/ios/NYTPhotoViewController.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/ios/NYTPhotoViewController.h b/Pod/Classes/ios/NYTPhotoViewController.h index e883b8a5..73906f20 100644 --- a/Pod/Classes/ios/NYTPhotoViewController.h +++ b/Pod/Classes/ios/NYTPhotoViewController.h @@ -73,4 +73,4 @@ extern NSString * const NYTPhotoViewControllerPhotoImageUpdatedNotification; @end -NS_ASSUME_NONNULL_END \ No newline at end of file +NS_ASSUME_NONNULL_END From 2329b0963f2e031597ae5487a5a1d375808aafca Mon Sep 17 00:00:00 2001 From: Danny Zlobinsky Date: Mon, 4 Jan 2016 10:53:47 -0500 Subject: [PATCH 3/3] Change imageData to be nullable in NYTPhoto --- Pod/Classes/ios/Protocols/NYTPhoto.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Pod/Classes/ios/Protocols/NYTPhoto.h b/Pod/Classes/ios/Protocols/NYTPhoto.h index 2a329f1e..b25e099c 100644 --- a/Pod/Classes/ios/Protocols/NYTPhoto.h +++ b/Pod/Classes/ios/Protocols/NYTPhoto.h @@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN * The image data to display. This will be preferred over the `image` property. * In case this is empty `image` will be used. The main advantage of using this is animated gif support. */ -@property (nonatomic, readonly) NSData *imageData; +@property (nonatomic, readonly, nullable) NSData *imageData; /** * A placeholder image for display while the image is loading.