-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds Nullability #399
base: master
Are you sure you want to change the base?
Adds Nullability #399
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,15 +14,17 @@ | |
*/ | ||
@interface MASViewAttribute : NSObject | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
/** | ||
* The view which the reciever relates to. Can be nil if item is not a view. | ||
*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, actually the view can be nil according to the comment, need to fix this in a new commit There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, fixed it. fixed also the designated initializer which allows There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually now did fix the convenience initializer, as the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i mean, it could be forced that the parameter is non-nil in the initializer, and the property still can become nullable - but as the |
||
@property (nonatomic, weak, readonly) MAS_VIEW *view; | ||
@property (nullable, nonatomic, weak, readonly) MAS_VIEW *view; | ||
|
||
/** | ||
* The item which the reciever relates to. | ||
*/ | ||
@property (nonatomic, weak, readonly) id item; | ||
@property (nullable, nonatomic, weak, readonly) id item; | ||
|
||
/** | ||
* The attribute which the reciever relates to | ||
|
@@ -32,12 +34,12 @@ | |
/** | ||
* Convenience initializer. | ||
*/ | ||
- (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; | ||
- (instancetype)initWithView:(nullable MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; | ||
|
||
/** | ||
* The designated initializer. | ||
*/ | ||
- (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; | ||
- (instancetype)initWithView:(nullable MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; | ||
|
||
/** | ||
* Determine whether the layoutAttribute is a size attribute | ||
|
@@ -46,4 +48,6 @@ | |
*/ | ||
- (BOOL)isSizeAttribute; | ||
|
||
NS_ASSUME_NONNULL_END | ||
|
||
@end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit awkward, i know, but otherwise the compiler will complain that the method should not return
nil
due to nullability.