Check out example codes for "pop last element array swift". It will help you in understanding the concepts better.

Code Example 1

// Initialize the Array
var a = [1,2,3]

// Remove last item
let lastItem = a.removeLast()

print(lastItem)
print(a)

Learn ReactJs, React Native from akashmittal.com