Conversation
| - (instancetype)initWithChildren:(NSArray *)children { | ||
| self = [super init]; | ||
| if (!self) return nil; | ||
| if (!self) return self; |
There was a problem hiding this comment.
this is a bit awkward, i know, but otherwise the compiler will complain that the method should not return nil due to nullability.
|
|
||
| /** | ||
| * The view which the reciever relates to. Can be nil if item is not a view. | ||
| */ |
There was a problem hiding this comment.
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.
ok, fixed it. fixed also the designated initializer which allows view to be nil too. did not fix the convenience initializer, as view ist used for both view and item there, and item may not be nil.
There was a problem hiding this comment.
actually now did fix the convenience initializer, as the item property is weak and thus needs to be nullable
There was a problem hiding this comment.
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 MASConstraintDelegateMock explicitly passes nil, I went with making it nullable.
|
In this case either you change the method to expect a nil return value or you throw an exception there... Both options may not be viable, but I personally find it very dangerous to have methods disobey their public API contracts. The compiler is right in this case. Sent from my iPhone
|
|
@Panajev: This is exactly the same - also returns |
…ies which cannot be nullable and other parameters that are explicitly allowed to be nil from the context
No more
make?inside blocks.