<!--
{
  "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/ExpressibleByIntegerLiteral",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s27ExpressibleByIntegerLiteralP"
  },
  "title" : "ExpressibleByIntegerLiteral"
}
-->

# ExpressibleByIntegerLiteral

A type that can be initialized with an integer literal.

```
protocol ExpressibleByIntegerLiteral
```

## Overview

The standard library integer and floating-point types, such as `Int` and
`Double`, conform to the `ExpressibleByIntegerLiteral` protocol. You can
initialize a variable or constant of any of these types by assigning an
integer literal.

```
// Type inferred as 'Int'
let cookieCount = 12

// An array of 'Int'
let chipsPerCookie = [21, 22, 25, 23, 24, 19]

// A floating-point value initialized using an integer literal
let redPercentage: Double = 1
// redPercentage == 1.0
```

# Conforming to ExpressibleByIntegerLiteral

To add `ExpressibleByIntegerLiteral` conformance to your custom type,
implement the required initializer.

---

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)