Skip to content
This repository has been archived by the owner on Jan 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #56 from ParsePlatform/nlutsenko.nullability_annot…
Browse files Browse the repository at this point in the history
…ation

Add backward-compatible nullability annotations to all public classes.
  • Loading branch information
nlutsenko committed Mar 2, 2015
2 parents fb0e813 + f3c12a7 commit 441143e
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 67 deletions.
8 changes: 7 additions & 1 deletion ParseUI/Classes/Cells/PFCollectionViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>

PFUI_ASSUME_NONNULL_BEGIN

@class PFImageView;
@class PFObject;

Expand Down Expand Up @@ -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
9 changes: 7 additions & 2 deletions ParseUI/Classes/Cells/PFPurchaseTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>
#import <ParseUI/PFTableViewCell.h>

PFUI_ASSUME_NONNULL_BEGIN

/*!
An enum that represents states of the PFPurchaseTableViewCell.
@see PFPurchaseTableViewCell
Expand Down Expand Up @@ -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
7 changes: 6 additions & 1 deletion ParseUI/Classes/Cells/PFTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>
#import <ParseUI/PFImageView.h>

PFUI_ASSUME_NONNULL_BEGIN

/*!
The `PFTableViewCell` class represents a table view cell which can download and display remote images stored on Parse.
Expand All @@ -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
28 changes: 16 additions & 12 deletions ParseUI/Classes/LogInViewController/PFLogInView.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#import <ParseUI/ParseUIConstants.h>

PFUI_ASSUME_NONNULL_BEGIN

/*!
`PFLogInFields` bitmask specifies the log in elements which are enabled in the view.
Expand Down Expand Up @@ -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
Expand All @@ -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
16 changes: 11 additions & 5 deletions ParseUI/Classes/LogInViewController/PFLogInViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>
#import <ParseUI/PFLogInView.h>

PFUI_ASSUME_NONNULL_BEGIN

@class PFSignUpViewController;
@class PFUser;
@protocol PFLogInViewControllerDelegate;
Expand All @@ -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
Expand All @@ -60,22 +63,22 @@
@see PFLogInViewControllerDelegate
*/
@property (nonatomic, weak) id<PFLogInViewControllerDelegate> delegate;
@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) id<PFLogInViewControllerDelegate> 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.
@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.
Expand Down Expand Up @@ -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.
Expand All @@ -165,3 +169,5 @@ shouldBeginLogInWithUsername:(NSString *)username
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController;

@end

PFUI_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
*
*/

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>
#import <ParseUI/PFQueryTableViewController.h>

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
Expand All @@ -38,3 +43,5 @@
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;

@end

PFUI_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

#import <UIKit/UIKit.h>

#import <ParseUI/ParseUIConstants.h>

PFUI_ASSUME_NONNULL_BEGIN

@class PFCollectionViewCell;
@class PFObject;
@class PFQuery;
Expand All @@ -45,7 +49,7 @@
/*!
@abstract The class name of the <PFObject> 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`.
Expand Down Expand Up @@ -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 <PFObject> that will be associated with this collection.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit 441143e

Please sign in to comment.