SwiftLogo

This could be your banner!

As developers, we sometimes have to check and see if an array, set, string, or other collection types are nil.

Thank you for reading this post, don't forget to subscribe!

In the past, you might write code like this:

let name = “”
if name.count = 0
{
print(“You did not give a name”)
}

But, with the new isEmpty statement, one can write the above like this:

let name = “”
if name.isEmpty
{
print(“You did not give a name)
}

Using the above statement makes development faster and easier to read and understand.

About Post Author

(Visited 13 times, 1 visits today)


Discover more from CompuScoop.com

Subscribe to get the latest posts sent to your email.

Catch up on what you’ve missed:

Verified by MonsterInsights