Convert from nullable object into nonnull (Objective-C)
Asked Answered
A

1

6

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?

Audryaudrye answered 15/7, 2015 at 4:1 Comment(0)
A
13

I think a cast here is appropriate?

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

Audryaudrye answered 17/8, 2015 at 4:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.