Skip to content

Use Array.isEmpty instead of checking count property #2476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2019

Conversation

dannliu
Copy link
Contributor

@dannliu dannliu commented Aug 17, 2019

According to the Xcode documentation, we should use isEmpty property to check whether your collection is empty.
https://developer.apple.com/documentation/swift/array/1688398-isempty

When you need to check whether your collection is empty, use the isEmpty property instead of checking that the count property is equal to zero. For collections that don’t conform to RandomAccessCollection, accessing the count property iterates through the elements of the collection.

@ikesyo
Copy link
Member

ikesyo commented Aug 17, 2019

@swift-ci test and merge

@swift-ci swift-ci merged commit 5041c75 into swiftlang:master Aug 17, 2019
@dannliu dannliu changed the title Use Array.isEmpty instead of checking account property Use Array.isEmpty instead of checking count property Aug 18, 2019
@dannliu dannliu deleted the Operation-minor-fix branch August 18, 2019 00:44
@dannliu dannliu restored the Operation-minor-fix branch August 18, 2019 00:44
@dannliu dannliu deleted the Operation-minor-fix branch August 18, 2019 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants