In Swift 1.0 you would count an array like this:
let items = [1, 2, 3] println(countElements(items))
countElements() function has been renamed to
count() in Swift 1.1, so the new code is this:
let items = [1, 2, 3] println(count(items))
Note: This has changed in later versions of Swift –
count is now a property of strings and collections.
SPONSORED Learn the most up-to-date techniques and strategies for testing new and legacy Swift code in this free practical course for iOS devs who want to become complete Senior iOS Developers.
Link copied to your pasteboard.