VYT VYT - 2 years ago 74
Swift Question

How to write if condition for empty tuple in swift?

I am stuck with if condition for this type of function return -

([(Range<String.Index>, Range<String.Index>)](), [(Range<String.Index>, Range<String.Index>)]())
. How to write if condition if this return is true, i.e. this tuple is empty ?

If returnOfFunction == ...
do something

Answer Source

You could simply check

if returnOfFunction.0.isEmpty && returnOfFunction.1.isEmpty
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download