Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert from nullable object into nonnull (Objective-C)

I've been using the new nullability stuff in Xcode 6.3

However, I'm running into an issue like this

[Object doSomethingWithNonNullParam:otherObject.nullableProperty];

Whats the best way to solve this If I'm confident otherObject.nullableProperty is not nil?

like image 605
Sam Jarman Avatar asked Dec 20 '22 02:12

Sam Jarman


1 Answers

I think a cast here is appropriate?

[Object doSomethingWithNonNullParam:(OtherObject *_Nonnull) otherObject.nullableProperty];

like image 115
Sam Jarman Avatar answered Jan 30 '23 23:01

Sam Jarman