I want to check if my array is empty or null, and on base of which I want to create a condition for example.
if(array == EMPTY){
//do something
}
Swift 3
As in latest version of swift 3 the ability to compare optionals with > and < is not avaliable
It is still possible to compare optionals with ==, so the best way to check if an optional array contains values is:
if array?.isEmpty == false {
print("There are objects!")
}
as per array count
if array?.count ?? 0 > 0 {
print("There are objects!")
}
There are other ways also and can be checked here link to the answer