Swift - isEmpty VS count
Sometimes when doing code reviews I find code where there’s a check for emptiness using the count property. In Swift, if your collection doesn’t conform to RandomAccessCollection, using count will have lineal complexity O(n) while if you use the isEmpty property you’ll have constant complexity O(1).
For big collections on a mobile app this may mean a difference in performance and it would be a capital sin on a server, where data collections are significantly bigger!
If your app does multiple emptiness checks this may have a real impact on performance!