---
title: "byteCount(style:allowedUnits:spellsOutZero:includesActualByteCount:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/formatstyle/bytecount(style:allowedunits:spellsoutzero:includesactualbytecount:)-59ep0"
---

# byteCount(style:allowedUnits:spellsOutZero:includesActualByteCount:)

Returns a format style to format a data storage value.

## Declaration

```swift
static func byteCount(style: ByteCountFormatStyle.Style, allowedUnits: ByteCountFormatStyle.Units = .all, spellsOutZero: Bool = true, includesActualByteCount: Bool = false) -> Self
```

## Parameters

- `style`: The style of byte count to express, such as memory or file system storage.
- `allowedUnits`: The units the format style can use to express the byte count.
- `spellsOutZero`: A Boolean value that indicates whether the format style should spell out zero-byte values as text, like Zero kB.
- `includesActualByteCount`: A Boolean value that indicates whether the format style should include the exact byte count, in addition to expressing it in terms of units. For example, 1 kB (1,024 bytes).

## Return Value

Return Value A format style for formatting a measurement of data storage, customized with the provided behaviors.

## Discussion

Discussion Use this type method when the call point allows the use of ByteCountFormatStyle. You typically do this when calling the formatted(_:) method of BinaryInteger values that represent byte counts, as seen here: let count: Int64 = 1024 let formatted = count.formatted(.byteCount(style: .memory)) // "1 kB"

## See Also

### Applying byte-count styles

- [ByteCountFormatStyle](foundation/bytecountformatstyle.md)
- [byteCount(style:allowedUnits:spellsOutZero:includesActualByteCount:)](foundation/formatstyle/bytecount(style:allowedunits:spellsoutzero:includesactualbytecount:)-ev0u.md)
- [Measurement.FormatStyle.ByteCount](foundation/measurement/formatstyle/bytecount.md)
