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) -> trueThe use of nil is more common and is the recommended convention.
Comments
Post a Comment