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

Commit 441143e

Browse files
committed
Merge pull request #56 from ParsePlatform/nlutsenko.nullability_annotation
Add backward-compatible nullability annotations to all public classes.
2 parents fb0e813 + f3c12a7 commit 441143e

File tree

13 files changed

+179
-67
lines changed

13 files changed

+179
-67
lines changed

ParseUI/Classes/Cells/PFCollectionViewCell.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
#import <UIKit/UIKit.h>
2323

24+
#import <ParseUI/ParseUIConstants.h>
25+
26+
PFUI_ASSUME_NONNULL_BEGIN
27+
2428
@class PFImageView;
2529
@class PFObject;
2630

@@ -50,6 +54,8 @@
5054
5155
@param object An instance of `PFObject` to update from.
5256
*/
53-
- (void)updateFromObject:(PFObject *)object;
57+
- (void)updateFromObject:(PFUI_NULLABLE PFObject *)object;
5458

5559
@end
60+
61+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/Cells/PFPurchaseTableViewCell.h

+7-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121

2222
#import <UIKit/UIKit.h>
2323

24+
#import <ParseUI/ParseUIConstants.h>
2425
#import <ParseUI/PFTableViewCell.h>
2526

27+
PFUI_ASSUME_NONNULL_BEGIN
28+
2629
/*!
2730
An enum that represents states of the PFPurchaseTableViewCell.
2831
@see PFPurchaseTableViewCell
@@ -53,11 +56,13 @@ typedef NS_ENUM(uint8_t, PFPurchaseTableViewCellState) {
5356
/*!
5457
@abstract Label where price of the product is displayed.
5558
*/
56-
@property (nonatomic, strong, readonly) UILabel *priceLabel;
59+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *priceLabel;
5760

5861
/*!
5962
@abstract Progress view that is shown, when the product is downloading.
6063
*/
61-
@property (nonatomic, strong, readonly) UIProgressView *progressView;
64+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIProgressView *progressView;
6265

6366
@end
67+
68+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/Cells/PFTableViewCell.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121

2222
#import <UIKit/UIKit.h>
2323

24+
#import <ParseUI/ParseUIConstants.h>
2425
#import <ParseUI/PFImageView.h>
2526

27+
PFUI_ASSUME_NONNULL_BEGIN
28+
2629
/*!
2730
The `PFTableViewCell` class represents a table view cell which can download and display remote images stored on Parse.
2831
@@ -36,6 +39,8 @@
3639
3740
@see PFImageView
3841
*/
39-
@property (nonatomic, strong, readonly) PFImageView *imageView;
42+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFImageView *imageView;
4043

4144
@end
45+
46+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/LogInViewController/PFLogInView.h

+16-12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323

2424
#import <ParseUI/ParseUIConstants.h>
2525

26+
PFUI_ASSUME_NONNULL_BEGIN
27+
2628
/*!
2729
`PFLogInFields` bitmask specifies the log in elements which are enabled in the view.
2830
@@ -82,14 +84,14 @@ typedef NS_OPTIONS(NSInteger, PFLogInFields) {
8284
8385
@discussion Used to lay out elements correctly when the presenting view controller has translucent elements.
8486
*/
85-
@property (nonatomic, weak) UIViewController *presentingViewController;
87+
@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) UIViewController *presentingViewController;
8688

8789
///--------------------------------------
8890
/// @name Customizing the Logo
8991
///--------------------------------------
9092

9193
/// The logo. By default, it is the Parse logo.
92-
@property (nonatomic, strong) UIView *logo;
94+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) UIView *logo;
9395

9496
///--------------------------------------
9597
/// @name Configure Username Behaviour
@@ -114,55 +116,57 @@ typedef NS_OPTIONS(NSInteger, PFLogInFields) {
114116
/*!
115117
@abstract The username text field. It is `nil` if the element is not enabled.
116118
*/
117-
@property (nonatomic, strong, readonly) PFTextField *usernameField;
119+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *usernameField;
118120

119121
/*!
120122
@abstract The password text field. It is `nil` if the element is not enabled.
121123
*/
122-
@property (nonatomic, strong, readonly) PFTextField *passwordField;
124+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFTextField *passwordField;
123125

124126
/*!
125127
@abstract The password forgotten button. It is `nil` if the element is not enabled.
126128
*/
127-
@property (nonatomic, strong, readonly) UIButton *passwordForgottenButton;
129+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *passwordForgottenButton;
128130

129131
/*!
130132
@abstract The log in button. It is `nil` if the element is not enabled.
131133
*/
132-
@property (nonatomic, strong, readonly) UIButton *logInButton;
134+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *logInButton;
133135

134136
/*!
135137
@abstract The Facebook button. It is `nil` if the element is not enabled.
136138
*/
137-
@property (nonatomic, strong, readonly) UIButton *facebookButton;
139+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *facebookButton;
138140

139141
/*!
140142
@abstract The Twitter button. It is `nil` if the element is not enabled.
141143
*/
142-
@property (nonatomic, strong, readonly) UIButton *twitterButton;
144+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *twitterButton;
143145

144146
/*!
145147
@abstract The sign up button. It is `nil` if the element is not enabled.
146148
*/
147-
@property (nonatomic, strong, readonly) UIButton *signUpButton;
149+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *signUpButton;
148150

149151
/*!
150152
@abstract It is `nil` if the element is not enabled.
151153
*/
152-
@property (nonatomic, strong, readonly) UIButton *dismissButton;
154+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UIButton *dismissButton;
153155

154156
/*!
155157
@abstract The facebook/twitter login label.
156158
157159
@deprecated This property is deprecated and will always be nil.
158160
*/
159-
@property (nonatomic, strong, readonly) UILabel *externalLogInLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil."));
161+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *externalLogInLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil."));
160162

161163
/*!
162164
@abstract The sign up label.
163165
164166
@deprecated This property is deprecated and will always be nil.
165167
*/
166-
@property (nonatomic, strong, readonly) UILabel *signUpLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil."));
168+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) UILabel *signUpLabel __attribute__(PARSE_UI_DEPRECATED("This property is deprecated and will always be nil."));
167169

168170
@end
171+
172+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/LogInViewController/PFLogInViewController.h

+11-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121

2222
#import <UIKit/UIKit.h>
2323

24+
#import <ParseUI/ParseUIConstants.h>
2425
#import <ParseUI/PFLogInView.h>
2526

27+
PFUI_ASSUME_NONNULL_BEGIN
28+
2629
@class PFSignUpViewController;
2730
@class PFUser;
2831
@protocol PFLogInViewControllerDelegate;
@@ -49,7 +52,7 @@
4952
5053
@see PFLogInView
5154
*/
52-
@property (nonatomic, strong, readonly) PFLogInView *logInView;
55+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong, readonly) PFLogInView *logInView;
5356

5457
///--------------------------------------
5558
/// @name Configuring Log In Behaviors
@@ -60,22 +63,22 @@
6063
6164
@see PFLogInViewControllerDelegate
6265
*/
63-
@property (nonatomic, weak) id<PFLogInViewControllerDelegate> delegate;
66+
@property (PFUI_NULLABLE_PROPERTY nonatomic, weak) id<PFLogInViewControllerDelegate> delegate;
6467

6568
/*!
6669
@abstract The facebook permissions that Facebook log in requests for.
6770
6871
@discussion If unspecified, the default is basic facebook permissions.
6972
*/
70-
@property (nonatomic, copy) NSArray *facebookPermissions;
73+
@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) NSArray *facebookPermissions;
7174

7275
/*!
7376
@abstract The sign up controller if sign up is enabled.
7477
7578
@discussion Use this to configure the sign up view, and the transition animation to the sign up view.
7679
The default is a sign up view with a username, a password, a dismiss button and a sign up button.
7780
*/
78-
@property (nonatomic, strong) PFSignUpViewController *signUpController;
81+
@property (PFUI_NULLABLE_PROPERTY nonatomic, strong) PFSignUpViewController *signUpController;
7982

8083
/*!
8184
@abstract Whether to prompt for the email as username on the login view.
@@ -155,7 +158,8 @@ shouldBeginLogInWithUsername:(NSString *)username
155158
@param logInController The login view controller where login failed.
156159
@param error `NSError` object representing the error that occured.
157160
*/
158-
- (void)logInViewController:(PFLogInViewController *)logInController didFailToLogInWithError:(NSError *)error;
161+
- (void)logInViewController:(PFLogInViewController *)logInController
162+
didFailToLogInWithError:(PFUI_NULLABLE NSError *)error;
159163

160164
/*!
161165
@abstract Sent to the delegate when the log in screen is cancelled.
@@ -165,3 +169,5 @@ shouldBeginLogInWithUsername:(NSString *)username
165169
- (void)logInViewControllerDidCancelLogIn:(PFLogInViewController *)logInController;
166170

167171
@end
172+
173+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/ProductTableViewController/PFProductTableViewController.h

+7
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
*
2020
*/
2121

22+
#import <UIKit/UIKit.h>
23+
24+
#import <ParseUI/ParseUIConstants.h>
2225
#import <ParseUI/PFQueryTableViewController.h>
2326

27+
PFUI_ASSUME_NONNULL_BEGIN
28+
2429
/*!
2530
`PFProductTableViewController` displays in-app purchase products stored on Parse.
2631
In addition to setting up in-app purchases in iTunes Connect, the app developer needs
@@ -38,3 +43,5 @@
3843
- (instancetype)initWithStyle:(UITableViewStyle)style NS_DESIGNATED_INITIALIZER;
3944

4045
@end
46+
47+
PFUI_ASSUME_NONNULL_END

ParseUI/Classes/QueryCollectionViewController/PFQueryCollectionViewController.h

+16-9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
#import <UIKit/UIKit.h>
2323

24+
#import <ParseUI/ParseUIConstants.h>
25+
26+
PFUI_ASSUME_NONNULL_BEGIN
27+
2428
@class PFCollectionViewCell;
2529
@class PFObject;
2630
@class PFQuery;
@@ -45,7 +49,7 @@
4549
/*!
4650
@abstract The class name of the <PFObject> this collection will use as a datasource.
4751
*/
48-
@property (nonatomic, copy) IBInspectable NSString *parseClassName;
52+
@property (PFUI_NULLABLE_PROPERTY nonatomic, copy) IBInspectable NSString *parseClassName;
4953

5054
/*!
5155
@abstract Whether the collection should use the default loading view. Default - `YES`.
@@ -84,7 +88,7 @@
8488
8589
@returns An initialized `PFQueryCollectionViewController` object or `nil` if the object couldn't be created.
8690
*/
87-
- (instancetype)initWithClassName:(NSString *)className;
91+
- (instancetype)initWithClassName:(PFUI_NULLABLE NSString *)className;
8892

8993
/*!
9094
@abstract Initializes a view controller with a class name of <PFObject> that will be associated with this collection.
@@ -94,7 +98,8 @@
9498
9599
@returns An initialized `PFQueryCollectionViewController` object or `nil` if the object couldn't be created.
96100
*/
97-
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout className:(NSString *)className NS_DESIGNATED_INITIALIZER;
101+
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
102+
className:(PFUI_NULLABLE NSString *)className NS_DESIGNATED_INITIALIZER;
98103

99104
///--------------------------------------
100105
/// @name Responding to Events
@@ -111,7 +116,7 @@
111116
call [super objectsDidLoad:] in your implementation.
112117
@param error The Parse error from running the PFQuery, if there was any.
113118
*/
114-
- (void)objectsDidLoad:(NSError *)error NS_REQUIRES_SUPER;
119+
- (void)objectsDidLoad:(PFUI_NULLABLE NSError *)error NS_REQUIRES_SUPER;
115120

116121
///--------------------------------------
117122
/// @name Accessing Results
@@ -132,7 +137,7 @@
132137
133138
@returns The object at the specified indexPath.
134139
*/
135-
- (PFObject *)objectAtIndexPath:(NSIndexPath *)indexPath;
140+
- (PFUI_NULLABLE PFObject *)objectAtIndexPath:(PFUI_NULLABLE NSIndexPath *)indexPath;
136141

137142
///--------------------------------------
138143
/// @name Loading Data
@@ -188,9 +193,9 @@
188193
189194
@returns The cell that represents this object.
190195
*/
191-
- (PFCollectionViewCell *)collectionView:(UICollectionView *)collectionView
192-
cellForItemAtIndexPath:(NSIndexPath *)indexPath
193-
object:(PFObject *)object;
196+
- (PFUI_NULLABLE PFCollectionViewCell *)collectionView:(UICollectionView *)collectionView
197+
cellForItemAtIndexPath:(NSIndexPath *)indexPath
198+
object:(PFUI_NULLABLE PFObject *)object;
194199

195200
/*!
196201
@discussion Override this method to customize the view that allows the user to load the
@@ -200,6 +205,8 @@
200205
201206
@returns The view that allows the user to paginate.
202207
*/
203-
- (UICollectionReusableView *)collectionViewReusableViewForNextPageAction:(UICollectionView *)collectionView;
208+
- (PFUI_NULLABLE UICollectionReusableView *)collectionViewReusableViewForNextPageAction:(UICollectionView *)collectionView;
204209

205210
@end
211+
212+
PFUI_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)