VYT VYT - 6 months ago 3x
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


You could simply check

if returnOfFunction.0.isEmpty && returnOfFunction.1.isEmpty