What is the difference between nil and None in Swift?

There is no difference, as .none (basically it's Optional.none) and nil are equivalent to each other.

In fact, this statement run in playground then it's outputs is true:

nil == .none || print(nil == .none) -> true

The use of nil is more common and is the recommended convention.

Comments

Popular posts from this blog

In Swift, Optionals and Optional Binding are key concepts for handling values ?

What is benifit of using higher order functions?

Swift Optionals and force unwrapping?