Re: How to fix "misuse of 'nonnull'" warnings in Xcode 7.3?
Re: How to fix "misuse of 'nonnull'" warnings in Xcode 7.3?
- Subject: Re: How to fix "misuse of 'nonnull'" warnings in Xcode 7.3?
- From: Jens Alfke <email@hidden>
- Date: Thu, 25 Feb 2016 16:14:42 -0800
With Nullability in this case, you should create a reference and check if it is nil before passing it to a method that expects nonnull. It's an extra little bit of code but it does exactly what this warning expects and is for. It's really the right thing to do based on what the API expects.
Often, yes. But there are a number of cases where you already know by other means that the value is non-null, for example if (a.count >= 3) [widgets addObject: a.firstObject] Testing a.firstObject for nil would be pointless.
This is the equivalent of those times when you use “!” to dereference an optional in Swift.
—Jens |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden