<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/ReversedCollection/isEmpty",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:SlsE7isEmptySbvp::SYNTHESIZED::s:s18ReversedCollectionV"
  },
  "title" : "isEmpty"
}
-->

# isEmpty

A Boolean value indicating whether the collection is empty.

```
var isEmpty: Bool { get }
```

## Discussion

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.

```
let horseName = "Silver"
if horseName.isEmpty {
    print("My horse has no name.")
} else {
    print("Hi ho, \(horseName)!")
}
// Prints "Hi ho, Silver!")
```

> Complexity: O(1)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)