Using assert for debugging Swift 5.1

Using assert for debugging Swift 5.1

Personally I don’t use a assert much but you can use it to make sure the value you are getting from a variable is the correct one.

The above code does not have an error so the program will continue but if we change the user name.

The program will hold on the assert And print the error message you have provided in the function.





Leave a Reply