What is equivalent in Swift to NSParameterAssert?

If there is no equivalent to what is suggested for checking nil parameters.

+7
ios swift
source share
1 answer

No need for this. If your function does not accept nil parameters, make sure that parameters are not optional.

If you want to claim that the value is not nil, you can use the regular statement.

assert(value != nil, "nil value") 
+17
source share

All Articles