<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "System",
  "identifier" : "/documentation/System/FileDescriptor/AccessMode",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "System"
    ],
    "preciseIdentifier" : "s:6System14FileDescriptorV10AccessModeV"
  },
  "title" : "FileDescriptor.AccessMode"
}
-->

# FileDescriptor.AccessMode

The desired read and write access for a newly opened file.

```
@frozen struct AccessMode
```

## Topics

### Creating an Access Mode

[`static var readOnly: FileDescriptor.AccessMode`](/documentation/System/FileDescriptor/AccessMode/readOnly)

Opens the file for reading only.

[`static var readWrite: FileDescriptor.AccessMode`](/documentation/System/FileDescriptor/AccessMode/readWrite)

Opens the file for reading and writing.

[`static var writeOnly: FileDescriptor.AccessMode`](/documentation/System/FileDescriptor/AccessMode/writeOnly)

Opens the file for writing only.

### Debugging

[`var description: String`](/documentation/System/FileDescriptor/AccessMode/description)

A textual representation of the access mode.

[`var debugDescription: String`](/documentation/System/FileDescriptor/AccessMode/debugDescription)

A textual representation of the access mode, suitable for debugging

### Working with C APIs

[`init(rawValue: CInt)`](/documentation/System/FileDescriptor/AccessMode/init(rawValue:))

Creates a strongly-typed access mode from a raw C access mode.

[`var rawValue: CInt`](/documentation/System/FileDescriptor/AccessMode/rawValue)

The raw C access mode.

### Comparing Access Modes

### Encoding Access Modes

### Default Implementations

[CustomDebugStringConvertible Implementations](/documentation/System/FileDescriptor/AccessMode/CustomDebugStringConvertible-Implementations)

[CustomStringConvertible Implementations](/documentation/System/FileDescriptor/AccessMode/CustomStringConvertible-Implementations)

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

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

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

---

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)