<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "macCatalyst: 17.4.0 -",
    "macOS: 14.4.0 -",
    "tvOS: 17.4.0 -",
    "visionOS: 1.1.0 -",
    "watchOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "LightweightCodeRequirements",
  "identifier" : "/documentation/LightweightCodeRequirements/IsMainBinary",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "LightweightCodeRequirements"
    ],
    "preciseIdentifier" : "s:27LightweightCodeRequirements12IsMainBinaryV"
  },
  "title" : "IsMainBinary"
}
-->

# IsMainBinary

A constraint that tests whether a code file is a main binary.

```
struct IsMainBinary
```

## Topics

### Initializers

[`init()`](/documentation/LightweightCodeRequirements/IsMainBinary/init())

Matches if the process or file is a main binary

[`init(Bool)`](/documentation/LightweightCodeRequirements/IsMainBinary/init(_:))

Matches if the process or file is or isn’t a main binary depending on the specified value.

[`init(from: any Decoder) throws`](/documentation/LightweightCodeRequirements/IsMainBinary/init(from:))

Create a new instance by decoding from the given decoder

### Instance Methods

[`func encode(to: any Encoder) throws`](/documentation/LightweightCodeRequirements/IsMainBinary/encode(to:))

Encodes this value into the given encoder

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`Decodable`](/documentation/Swift/Decodable)

[`OnDiskConstraint`](/documentation/LightweightCodeRequirements/OnDiskConstraint)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)