Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent in Swift to NSParameterAssert?

Tags:

ios

swift

If there is no equivalent what is the suggested way to check for nil params.

like image 689
ribeto Avatar asked Sep 16 '14 22:09

ribeto


1 Answers

There is no need for it. If your function doesn't accept nil parameters, make sure the parameters aren't optionals.

If you want to assert that a value is non-nil you can use a regular assert.

assert(value != nil, "nil value")
like image 103
Connor Avatar answered Oct 18 '22 16:10

Connor