<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/IntegerFormatStyle/sign(strategy:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation18IntegerFormatStyleV4sign8strategyACyxGAA06NumbercD13ConfigurationO19SignDisplayStrategyV_tF"
  },
  "title" : "sign(strategy:)"
}
-->

# sign(strategy:)

Modifies the format style to use the specified sign display strategy for displaying or omitting sign symbols.

```
func sign(strategy: IntegerFormatStyle<Value>.Configuration.SignDisplayStrategy) -> IntegerFormatStyle<Value>
```

## Parameters

`strategy`

The sign display strategy to apply to the format style, such as [`automatic`](/documentation/Foundation/NumberFormatStyleConfiguration/SignDisplayStrategy/automatic) or [`never`](/documentation/Foundation/NumberFormatStyleConfiguration/SignDisplayStrategy/never).

## Return Value

An integer format style modified to use the specified sign display strategy.

## Discussion

The following example creates a default [`IntegerFormatStyle`](/documentation/Foundation/IntegerFormatStyle) for the `en_US` locale, and a second style that displays a sign for all values except zero. It then applies each style to an array of integers. The formatting that the modified style applies adds the negative (`-`) or positive (`+`) sign to all the numbers.

```swift
let defaultStyle = IntegerFormatStyle<Int>(locale: Locale(identifier: "en_US"))
let alwaysStyle = defaultStyle.sign(strategy: .always(includingZero: false))
let nums = [-2, -1, 0, 1, 2]
let defaultNums = nums.map { defaultStyle.format($0) } // ["-2", "-1", "0", "1", "2"]
let alwaysNums = nums.map { alwaysStyle.format($0) } // ["-2", "-1", "0", "+1", "+2"]
```

---

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)