Masonry
Masonry copied to clipboard
Adds Nullability
No more make? inside blocks.
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
On 31 Oct 2016, at 07:48, fabb [email protected] wrote:
@fabb commented on this pull request.
In Masonry/MASCompositeConstraint.m:
self = [super init];
- if (!self) return nil;
- if (!self) return self; this is a bit awkward, i know, but otherwise the compiler will complain that the method should not return nil due to nullability.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@Panajev:
Actually Apple's default implementation of init looks like this:
- (id)init {
if (self = [super init]) {
// code
}
return self;
}
This is exactly the same - also returns self when !self.