Swift - Checking the Size of an Array

Introduction

To get the length of an array, use the count property:

var OSes :[String]  = ["iOS", "Android", "Windows"]
var lengthofArray = OSes.count  

To check whether an array is empty, use the isEmpty() function:

var OSes :[String]  = ["iOS", "Android", "Windows"]
var arrayIsEmpty = OSes.isEmpty
print(arrayIsEmpty)

Related Topic