From 51d18b347d9ea409f222f29bd4770806a98fb176 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 20:59:03 +0000 Subject: [PATCH 1/8] Add macros for backward compatible nullability support. --- ParseUI/Other/ParseUIConstants.h | 57 +++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/ParseUI/Other/ParseUIConstants.h b/ParseUI/Other/ParseUIConstants.h index 41e00e4..19cfa1d 100644 --- a/ParseUI/Other/ParseUIConstants.h +++ b/ParseUI/Other/ParseUIConstants.h @@ -19,19 +19,58 @@ * */ +#import +#import + #ifndef ParseUI_ParseUIConstants_h #define ParseUI_ParseUIConstants_h +///-------------------------------------- +/// @name Deprecated Macros +///-------------------------------------- + #ifndef PARSE_UI_DEPRECATED - #ifdef __deprecated_msg - #define PARSE_UI_DEPRECATED(_MSG) (deprecated(_MSG)) - #else - #ifdef __deprecated - #define PARSE_UI_DEPRECATED(_MSG) (deprecated) - #else - #define PARSE_UI_DEPRECATED(_MSG) - #endif - #endif +# ifdef __deprecated_msg +# define PARSE_UI_DEPRECATED(_MSG) (deprecated(_MSG)) +# else +# ifdef __deprecated +# define PARSE_UI_DEPRECATED(_MSG) (deprecated) +# else +# define PARSE_UI_DEPRECATED(_MSG) +# endif +# endif +#endif + +///-------------------------------------- +/// @name Nullability Support +///-------------------------------------- + +#if __has_feature(nullability) +# define PFUI_NULLABLE nullable +# define PFUI_NULLABLE_S __nullable +# define PFUI_NULL_UNSPECIFIED null_unspecified +# define PFUI_NULLABLE_PROPERTY nullable, +#else +# define PFUI_NULLABLE +# define PFUI_NULLABLE_S +# define PFUI_NULL_UNSPECIFIED +# define PFUI_NULLABLE_PROPERTY +#endif + +#if __has_feature(assume_nonnull) +# ifdef NS_ASSUME_NONNULL_BEGIN +# define PFUI_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN +# else +# define PFUI_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +# endif +# ifdef NS_ASSUME_NONNULL_END +# define PFUI_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END +# else +# define PFUI_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +# endif +#else +# define PFUI_ASSUME_NONNULL_BEGIN +# define PFUI_ASSUME_NONNULL_END #endif #endif From a9b28b52c20700e350cf3de3a9261c0bd4f50424 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:13:22 +0000 Subject: [PATCH 2/8] Add nullability annotations to PFLogInViewController, PFLogInView. --- .../Classes/LogInViewController/PFLogInView.h | 28 +++++++++++-------- .../PFLogInViewController.h | 16 +++++++---- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/ParseUI/Classes/LogInViewController/PFLogInView.h b/ParseUI/Classes/LogInViewController/PFLogInView.h index b31f501..ee71b02 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInView.h +++ b/ParseUI/Classes/LogInViewController/PFLogInView.h @@ -23,6 +23,8 @@ #import +PFUI_ASSUME_NONNULL_BEGIN + /*! `PFLogInFields` bitmask specifies the log in elements which are enabled in the view. @@ -82,14 +84,14 @@ typedef NS_OPTIONS(NSInteger, PFLogInFields) { @discussion Used to lay out elements correctly when the presenting view controller has translucent elements. */ -@property (nonatomic, weak) UIViewController *presentingViewController; +@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) UIViewController *presentingViewController; ///-------------------------------------- /// @name Customizing the Logo ///-------------------------------------- /// The logo. By default, it is the Parse logo. -@property (nonatomic, strong) UIView *logo; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) UIView *logo; ///-------------------------------------- /// @name Configure Username Behaviour @@ -114,55 +116,57 @@ typedef NS_OPTIONS(NSInteger, PFLogInFields) { /*! @abstract The username text field. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) PFTextField *usernameField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *usernameField; /*! @abstract The password text field. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) PFTextField *passwordField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *passwordField; /*! @abstract The password forgotten button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *passwordForgottenButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *passwordForgottenButton; /*! @abstract The log in button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *logInButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *logInButton; /*! @abstract The Facebook button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *facebookButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *facebookButton; /*! @abstract The Twitter button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *twitterButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *twitterButton; /*! @abstract The sign up button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *signUpButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *signUpButton; /*! @abstract It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *dismissButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *dismissButton; /*! @abstract The facebook/twitter login label. @deprecated This property is deprecated and will always be nil. */ -@property (nonatomic, strong, readonly) UILabel *externalLogInLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil.")); +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *externalLogInLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil.")); /*! @abstract The sign up label. @deprecated This property is deprecated and will always be nil. */ -@property (nonatomic, strong, readonly) UILabel *signUpLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil.")); +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *signUpLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil.")); @end + +PFUI_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/LogInViewController/PFLogInViewController.h b/ParseUI/Classes/LogInViewController/PFLogInViewController.h index 458218c..9ca9a08 100644 --- a/ParseUI/Classes/LogInViewController/PFLogInViewController.h +++ b/ParseUI/Classes/LogInViewController/PFLogInViewController.h @@ -21,8 +21,11 @@ #import +#import #import +PFUI_ASSUME_NONNULL_BEGIN + @class PFSignUpViewController; @class PFUser; @protocol PFLogInViewControllerDelegate; @@ -49,7 +52,7 @@ @see PFLogInView */ -@property (nonatomic, strong, readonly) PFLogInView *logInView; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFLogInView *logInView; ///-------------------------------------- /// @name Configuring Log In Behaviors @@ -60,14 +63,14 @@ @see PFLogInViewControllerDelegate */ -@property (nonatomic, weak) id delegate; +@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) id delegate; /*! @abstract The facebook permissions that Facebook log in requests for. @discussion If unspecified, the default is basic facebook permissions. */ -@property (nonatomic, copy) NSArray *facebookPermissions; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) NSArray *facebookPermissions; /*! @abstract The sign up controller if sign up is enabled. @@ -75,7 +78,7 @@ @discussion Use this to configure the sign up view, and the transition animation to the sign up view. The default is a sign up view with a username, a password, a dismiss button and a sign up button. */ -@property (nonatomic, strong) PFSignUpViewController *signUpController; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) PFSignUpViewController *signUpController; /*! @abstract Whether to prompt for the email as username on the login view. @@ -155,7 +158,8 @@ shouldBeginLogInWithUsername:(NSString *)username @param logInController The login view controller where login failed. @param error `NSError` object representing the error that occured. */ -- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error; +- (void)logInViewController:(PFLogInViewController *)logInController + didFailToLogInWithError:(PFUI_NULLABLE NSError *)error; /*! @abstract Sent to the delegate when the log in screen is cancelled. @@ -165,3 +169,5 @@ shouldBeginLogInWithUsername:(NSString *)username - (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController; @end + +PFUI_ASSUME_NONNULL_END From 9f02988f55d06a153b14750eb92271a0157d0aa2 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:11:16 +0000 Subject: [PATCH 3/8] Add nullability annotations to PFSignUpViewController, PFSignUpView. --- .../SignUpViewController/PFSignUpView.h | 22 ++++++++++++------- .../PFSignUpViewController.h | 12 +++++++--- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ParseUI/Classes/SignUpViewController/PFSignUpView.h b/ParseUI/Classes/SignUpViewController/PFSignUpView.h index 055925a..d6a8795 100644 --- a/ParseUI/Classes/SignUpViewController/PFSignUpView.h +++ b/ParseUI/Classes/SignUpViewController/PFSignUpView.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + /*! `PFSignUpFields` bitmask specifies the sign up elements which are enabled in the view. @@ -72,7 +76,7 @@ typedef NS_OPTIONS(NSInteger, PFSignUpFields) { @discussion Used to lay out elements correctly when the presenting view controller has translucent elements. */ -@property (nonatomic, weak) UIViewController *presentingViewController; +@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) UIViewController *presentingViewController; ///-------------------------------------- /// @name Customizing the Logo @@ -81,7 +85,7 @@ typedef NS_OPTIONS(NSInteger, PFSignUpFields) { /*! @abstract The logo. By default, it is the Parse logo. */ -@property (nonatomic, strong) UIView *logo; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) UIView *logo; ///-------------------------------------- /// @name Configure Username Behaviour @@ -106,33 +110,35 @@ typedef NS_OPTIONS(NSInteger, PFSignUpFields) { /*! @abstract The username text field. */ -@property (nonatomic, strong, readonly) PFTextField *usernameField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *usernameField; /*! @abstract The password text field. */ -@property (nonatomic, strong, readonly) PFTextField *passwordField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *passwordField; /*! @abstract The email text field. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) PFTextField *emailField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *emailField; /*! @abstract The additional text field. It is `nil` if the element is not enabled. @discussion This field is intended to be customized. */ -@property (nonatomic, strong, readonly) PFTextField *additionalField; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *additionalField; /*! @abstract The sign up button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *signUpButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *signUpButton; /*! @abstract The dismiss button. It is `nil` if the element is not enabled. */ -@property (nonatomic, strong, readonly) UIButton *dismissButton; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *dismissButton; @end + +PFUI_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/SignUpViewController/PFSignUpViewController.h b/ParseUI/Classes/SignUpViewController/PFSignUpViewController.h index eca2bd0..88b2332 100644 --- a/ParseUI/Classes/SignUpViewController/PFSignUpViewController.h +++ b/ParseUI/Classes/SignUpViewController/PFSignUpViewController.h @@ -21,11 +21,14 @@ #import +#import #import @class PFUser; @protocol PFSignUpViewControllerDelegate; +PFUI_ASSUME_NONNULL_BEGIN + /*! The `PFSignUpViewController` class that presents and manages a standard authentication interface for signing up a . @@ -48,7 +51,7 @@ @see PFSignUpView */ -@property (nonatomic, strong, readonly) PFSignUpView *signUpView; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFSignUpView *signUpView; ///-------------------------------------- /// @name Configuring Sign Up Behaviors @@ -59,7 +62,7 @@ @see PFSignUpViewControllerDelegate */ -@property (nonatomic, weak) id delegate; +@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) id delegate; /*! @abstract Minimum required password length for user signups, defaults to `0`. @@ -142,7 +145,8 @@ extern NSString *const PFSignUpCancelNotification; @param signUpController The signup view controller where signup failed. @param error `NSError` object representing the error that occured. */ -- (void)signUpViewController:(PFSignUpViewController *)signUpController didFailToSignUpWithError:(NSError *)error; +- (void)signUpViewController:(PFSignUpViewController *)signUpController + didFailToSignUpWithError:(PFUI_NULLABLE NSError *)error; /*! @abstract Sent to the delegate when the sign up screen is cancelled. @@ -152,3 +156,5 @@ extern NSString *const PFSignUpCancelNotification; - (void)signUpViewControllerDidCancelSignUp:(PFSignUpViewController *)signUpController; @end + +PFUI_ASSUME_NONNULL_END From efe64e1f4fc6212e11abdab9116aedd2b4537c7d Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 20:59:19 +0000 Subject: [PATCH 4/8] Add nullability annotations to PFQueryTableViewController. --- .../PFQueryTableViewController.h | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.h b/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.h index c14c435..bf9e5ad 100644 --- a/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.h +++ b/ParseUI/Classes/QueryTableViewController/PFQueryTableViewController.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + @class PFObject; @class PFQuery; @class PFTableViewCell; @@ -52,7 +56,8 @@ @returns An initialized `PFQueryTableViewController` object or `nil` if the object couldn't be created. */ -- (instancetype)initWithStyle:(UITableViewStyle)style className:(NSString *)className NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithStyle:(UITableViewStyle)style + className:(PFUI_NULLABLE NSString *)className NS_DESIGNATED_INITIALIZER; /*! @abstract Initializes with a class name of the PFObjects that will be associated with this table. @@ -61,7 +66,7 @@ @returns An initialized `PFQueryTableViewController` object or `nil` if the object couldn't be created. */ -- (instancetype)initWithClassName:(NSString *)className; +- (instancetype)initWithClassName:(PFUI_NULLABLE NSString *)className; ///-------------------------------------- /// @name Configuring Behavior @@ -70,28 +75,28 @@ /*! @abstract The class name of the this table will use as a datasource. */ -@property (nonatomic, copy) IBInspectable NSString *parseClassName; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) IBInspectable NSString *parseClassName; /*! @abstract The key to use to display for the cell text label. @discussion This won't apply if you override */ -@property (nonatomic, copy) IBInspectable NSString *textKey; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) IBInspectable NSString *textKey; /*! @abstract The key to use to display for the cell image view. @discussion This won't apply if you override */ -@property (nonatomic, copy) IBInspectable NSString *imageKey; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) IBInspectable NSString *imageKey; /*! @abstract The image to use as a placeholder for the cell images. @discussion This won't apply if you override */ -@property (nonatomic, strong) IBInspectable UIImage *placeholderImage; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) IBInspectable UIImage *placeholderImage; /*! @abstract Whether the table should use the default loading view. Default - `YES`. @@ -133,7 +138,7 @@ call [super objectsDidLoad:] in your implementation. @param error The Parse error from running the PFQuery, if there was any. */ -- (void)objectsDidLoad:(NSError *)error; +- (void)objectsDidLoad:(PFUI_NULLABLE NSError *)error; ///-------------------------------------- /// @name Accessing Results @@ -142,7 +147,7 @@ /*! @abstract The array of instances of that is used as a data source. */ -@property (nonatomic, copy, readonly) NSArray *objects; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy, readonly) NSArray *objects; /*! @abstract Returns an object at a particular indexPath. @@ -154,7 +159,7 @@ @returns The object at the specified index */ -- (PFObject *)objectAtIndexPath:(NSIndexPath *)indexPath; +- (PFUI_NULLABLE PFObject *)objectAtIndexPath:(PFUI_NULLABLE NSIndexPath *)indexPath; /*! @abstract Clears the table of all objects. @@ -208,9 +213,9 @@ @returns The cell that represents this object. */ -- (PFTableViewCell *)tableView:(UITableView *)tableView - cellForRowAtIndexPath:(NSIndexPath *)indexPath - object:(PFObject *)object; +- (PFUI_NULLABLE PFTableViewCell *)tableView:(UITableView *)tableView + cellForRowAtIndexPath:(NSIndexPath *)indexPath + object:(PFUI_NULLABLE PFObject *)object; /*! @discussion Override this method to customize the cell that allows the user to load the @@ -221,6 +226,9 @@ @returns The cell that allows the user to paginate. */ -- (PFTableViewCell *)tableView:(UITableView *)tableView cellForNextPageAtIndexPath:(NSIndexPath *)indexPath; +- (PFUI_NULLABLE PFTableViewCell *)tableView:(UITableView *)tableView + cellForNextPageAtIndexPath:(NSIndexPath *)indexPath; @end + +PFUI_ASSUME_NONNULL_END From 4d270a7362061f05832fc731625802e28c73a120 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:20:40 +0000 Subject: [PATCH 5/8] Add nullability annotations to PFQueryCollectionViewController. --- .../PFQueryCollectionViewController.h | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.h b/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.h index ab4c3d4..6706935 100644 --- a/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.h +++ b/ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + @class PFCollectionViewCell; @class PFObject; @class PFQuery; @@ -45,7 +49,7 @@ /*! @abstract The class name of the this collection will use as a datasource. */ -@property (nonatomic, copy) IBInspectable NSString *parseClassName; +@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) IBInspectable NSString *parseClassName; /*! @abstract Whether the collection should use the default loading view. Default - `YES`. @@ -84,7 +88,7 @@ @returns An initialized `PFQueryCollectionViewController` object or `nil` if the object couldn't be created. */ -- (instancetype)initWithClassName:(NSString *)className; +- (instancetype)initWithClassName:(PFUI_NULLABLE NSString *)className; /*! @abstract Initializes a view controller with a class name of that will be associated with this collection. @@ -94,7 +98,8 @@ @returns An initialized `PFQueryCollectionViewController` object or `nil` if the object couldn't be created. */ -- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout className:(NSString *)className NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout + className:(PFUI_NULLABLE NSString *)className NS_DESIGNATED_INITIALIZER; ///-------------------------------------- /// @name Responding to Events @@ -111,7 +116,7 @@ call [super objectsDidLoad:] in your implementation. @param error The Parse error from running the PFQuery, if there was any. */ -- (void)objectsDidLoad:(NSError *)error NS_REQUIRES_SUPER; +- (void)objectsDidLoad:(PFUI_NULLABLE NSError *)error NS_REQUIRES_SUPER; ///-------------------------------------- /// @name Accessing Results @@ -132,7 +137,7 @@ @returns The object at the specified indexPath. */ -- (PFObject *)objectAtIndexPath:(NSIndexPath *)indexPath; +- (PFUI_NULLABLE PFObject *)objectAtIndexPath:(PFUI_NULLABLE NSIndexPath *)indexPath; ///-------------------------------------- /// @name Loading Data @@ -188,9 +193,9 @@ @returns The cell that represents this object. */ -- (PFCollectionViewCell *)collectionView:(UICollectionView *)collectionView - cellForItemAtIndexPath:(NSIndexPath *)indexPath - object:(PFObject *)object; +- (PFUI_NULLABLE PFCollectionViewCell *)collectionView:(UICollectionView *)collectionView + cellForItemAtIndexPath:(NSIndexPath *)indexPath + object:(PFUI_NULLABLE PFObject *)object; /*! @discussion Override this method to customize the view that allows the user to load the @@ -200,6 +205,8 @@ @returns The view that allows the user to paginate. */ -- (UICollectionReusableView *)collectionViewReusableViewForNextPageAction:(UICollectionView *)collectionView; +- (PFUI_NULLABLE UICollectionReusableView *)collectionViewReusableViewForNextPageAction:(UICollectionView *)collectionView; @end + +PFUI_ASSUME_NONNULL_END From 8725b94cf06c5c151b91bcd6026b5e49749b8db1 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:36:17 +0000 Subject: [PATCH 6/8] Add nullability annotations to PFProductTableViewController. --- .../PFProductTableViewController.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.h b/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.h index 78cc4c2..fa5ce55 100644 --- a/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.h +++ b/ParseUI/Classes/ProductTableViewController/PFProductTableViewController.h @@ -19,8 +19,13 @@ * */ +#import + +#import #import +PFUI_ASSUME_NONNULL_BEGIN + /*! `PFProductTableViewController` displays in-app purchase products stored on Parse. In addition to setting up in-app purchases in iTunes Connect, the app developer needs @@ -38,3 +43,5 @@ - (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER; @end + +PFUI_ASSUME_NONNULL_END From 31dd778c9bd286185ab4546b53c5ea3a81d79cfb Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:36:03 +0000 Subject: [PATCH 7/8] Add nullability annotations to PFImageView, PFTextField. --- ParseUI/Classes/Views/PFImageView.h | 13 ++++++++++--- ParseUI/Classes/Views/PFTextField.h | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ParseUI/Classes/Views/PFImageView.h b/ParseUI/Classes/Views/PFImageView.h index d8db09d..c0af7ef 100644 --- a/ParseUI/Classes/Views/PFImageView.h +++ b/ParseUI/Classes/Views/PFImageView.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + @class BFTask; @class PFFile; @@ -34,7 +38,7 @@ @warning Note that the download does not start until is called. */ -@property (nonatomic, strong) PFFile *file; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) PFFile *file; /*! @abstract Initiate downloading of the remote image. @@ -52,7 +56,7 @@ @param completion the completion block. */ -- (void)loadInBackground:(void (^)(UIImage *image, NSError *error))completion; +- (void)loadInBackground:(PFUI_NULLABLE void (^)(PFUI_NULLABLE_S UIImage *image, PFUI_NULLABLE_S NSError *error))completion; /*! @abstract Initiate downloading of the remote image. @@ -63,6 +67,9 @@ @param progressBlock called with the download progress as the image is being downloaded. Will be called with a value of 100 before the completion block is called. */ -- (void)loadInBackground:(void (^)(UIImage *, NSError *))completion progressBlock:(void (^)(int percentDone))progressBlock; +- (void)loadInBackground:(PFUI_NULLABLE void (^)(PFUI_NULLABLE_S UIImage *image, PFUI_NULLABLE_S NSError *error))completion + progressBlock:(PFUI_NULLABLE void (^)(int percentDone))progressBlock; @end + +PFUI_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/Views/PFTextField.h b/ParseUI/Classes/Views/PFTextField.h index aeafef5..5bfb168 100644 --- a/ParseUI/Classes/Views/PFTextField.h +++ b/ParseUI/Classes/Views/PFTextField.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + /*! `PFTextFieldSeparatorStyle` bitmask specifies the style of the separators, that should be used for a given `PFTextField`. @@ -56,7 +60,7 @@ typedef NS_OPTIONS(uint8_t, PFTextFieldSeparatorStyle){ @discussion Default: `227,227,227,1.0`. */ -@property (nonatomic, strong) UIColor *separatorColor UI_APPEARANCE_SELECTOR; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) UIColor *separatorColor UI_APPEARANCE_SELECTOR; /*! This method is a convenience initializer that sets both `frame` and `separatorStyle` for an instance of `PFTextField.` @@ -69,3 +73,5 @@ typedef NS_OPTIONS(uint8_t, PFTextFieldSeparatorStyle){ - (instancetype)initWithFrame:(CGRect)frame separatorStyle:(PFTextFieldSeparatorStyle)separatorStyle; @end + +PFUI_ASSUME_NONNULL_END From f3c12a74a6f0b4909a6a649c8e1d53af56c2abd9 Mon Sep 17 00:00:00 2001 From: Nikita Lutsenko Date: Mon, 16 Feb 2015 21:36:31 +0000 Subject: [PATCH 8/8] Add nullability annotations to all cells. --- ParseUI/Classes/Cells/PFCollectionViewCell.h | 8 +++++++- ParseUI/Classes/Cells/PFPurchaseTableViewCell.h | 9 +++++++-- ParseUI/Classes/Cells/PFTableViewCell.h | 7 ++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ParseUI/Classes/Cells/PFCollectionViewCell.h b/ParseUI/Classes/Cells/PFCollectionViewCell.h index 7760837..71b3642 100644 --- a/ParseUI/Classes/Cells/PFCollectionViewCell.h +++ b/ParseUI/Classes/Cells/PFCollectionViewCell.h @@ -21,6 +21,10 @@ #import +#import + +PFUI_ASSUME_NONNULL_BEGIN + @class PFImageView; @class PFObject; @@ -50,6 +54,8 @@ @param object An instance of `PFObject` to update from. */ -- (void)updateFromObject:(PFObject *)object; +- (void)updateFromObject:(PFUI_NULLABLE PFObject *)object; @end + +PFUI_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/Cells/PFPurchaseTableViewCell.h b/ParseUI/Classes/Cells/PFPurchaseTableViewCell.h index 8c47c7c..eb80487 100644 --- a/ParseUI/Classes/Cells/PFPurchaseTableViewCell.h +++ b/ParseUI/Classes/Cells/PFPurchaseTableViewCell.h @@ -21,8 +21,11 @@ #import +#import #import +PFUI_ASSUME_NONNULL_BEGIN + /*! An enum that represents states of the PFPurchaseTableViewCell. @see PFPurchaseTableViewCell @@ -53,11 +56,13 @@ typedef NS_ENUM(uint8_t, PFPurchaseTableViewCellState) { /*! @abstract Label where price of the product is displayed. */ -@property (nonatomic, strong, readonly) UILabel *priceLabel; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *priceLabel; /*! @abstract Progress view that is shown, when the product is downloading. */ -@property (nonatomic, strong, readonly) UIProgressView *progressView; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIProgressView *progressView; @end + +PFUI_ASSUME_NONNULL_END diff --git a/ParseUI/Classes/Cells/PFTableViewCell.h b/ParseUI/Classes/Cells/PFTableViewCell.h index c672bdd..9238d99 100644 --- a/ParseUI/Classes/Cells/PFTableViewCell.h +++ b/ParseUI/Classes/Cells/PFTableViewCell.h @@ -21,8 +21,11 @@ #import +#import #import +PFUI_ASSUME_NONNULL_BEGIN + /*! The `PFTableViewCell` class represents a table view cell which can download and display remote images stored on Parse. @@ -36,6 +39,8 @@ @see PFImageView */ -@property (nonatomic, strong, readonly) PFImageView *imageView; +@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFImageView *imageView; @end + +PFUI_ASSUME_NONNULL_END