<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSHFSTypeCodeFromFileType(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@F@NSHFSTypeCodeFromFileType"
  },
  "title" : "NSHFSTypeCodeFromFileType(_:)"
}
-->

# NSHFSTypeCodeFromFileType(_:)

Returns a file type code.

```
func NSHFSTypeCodeFromFileType(_ fileTypeString: String!) -> OSType
```

## Parameters

`fileTypeString`

A string of the sort encoded by `NSFileTypeForHFSTypeCode()`.

## Return Value

The HFS file type code corresponding to `fileTypeString`, or `0` if it cannot be found.

## Discussion

---

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)