---
title: PlatformType
framework: lightweightcoderequirements
role: symbol
role_heading: Structure
path: lightweightcoderequirements/platformtype
---

# PlatformType

A constraint that tests whether a code file or running process targets a given platform.

## Declaration

```swift
struct PlatformType
```

## Overview

Overview For ProcessCodeRequirement and LaunchCodeRequirement this constraint matches the platform type of the process  as known to the kernel. For OnDiskCodeRequirement this constraint matches the platforms supported in Mach-O load commands. The OnDiskCodeRequirement will be matched against a SecStaticCodeRef. For this constraint to match, the SecStaticCodeRef must reference a Mach-O. If the SecStaticCodeRef references a specific architecture of a Mach-O then this constraint will be matched against the first LC_BUILD_VERSION or LC_VERSION_MIN_*OS load command in the Mach-O. If the SecStaticCodeRef references a file, then this constraint will match against the load commands in the architecture that is most likely to run on the platform the code is running on.

## Topics

### Structures

- [PlatformType.Value](lightweightcoderequirements/platformtype/value.md)

### Initializers

- [init(_:)](lightweightcoderequirements/platformtype/init(_:).md)
- [init(from:)](lightweightcoderequirements/platformtype/init(from:).md)

### Instance Methods

- [encode(to:)](lightweightcoderequirements/platformtype/encode(to:).md)

### Type Aliases

- [PlatformType.DataType](lightweightcoderequirements/platformtype/datatype.md)
- [PlatformType.OutType](lightweightcoderequirements/platformtype/outtype.md)

### Type Methods

- [in(_:)](lightweightcoderequirements/platformtype/in(_:)-1ndmu.md)
- [in(_:)](lightweightcoderequirements/platformtype/in(_:)-44pc3.md)

## Relationships

### Conforms To

- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [LaunchConstraint](lightweightcoderequirements/launchconstraint.md)
- [OnDiskConstraint](lightweightcoderequirements/ondiskconstraint.md)
- [ProcessConstraint](lightweightcoderequirements/processconstraint.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Testing properties of executable code

- [CodeDirectoryHash](lightweightcoderequirements/codedirectoryhash.md)
- [EntitlementsQuery](lightweightcoderequirements/entitlementsquery.md)
- [InfoPlistHash](lightweightcoderequirements/infoplisthash.md)
- [IsInitProcess](lightweightcoderequirements/isinitprocess.md)
- [IsMainBinary](lightweightcoderequirements/ismainbinary.md)
- [IsSIPProtected](lightweightcoderequirements/issipprotected.md)
- [SigningIdentifier](lightweightcoderequirements/signingidentifier.md)
- [TeamIdentifier](lightweightcoderequirements/teamidentifier.md)
- [ValidationCategory](lightweightcoderequirements/validationcategory.md)
