---
title: "NSHFSTypeCodeFromFileType(_:)"
framework: foundation
role: symbol
role_heading: Function
path: "foundation/nshfstypecodefromfiletype(_:)"
---

# NSHFSTypeCodeFromFileType(_:)

Returns a file type code.

## Declaration

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

## Parameters

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

## Return Value

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

## See Also

### Working with HFS file types

- [NSFileTypeForHFSTypeCode(_:)](foundation/nsfiletypeforhfstypecode(_:).md)
- [NSHFSTypeOfFile(_:)](foundation/nshfstypeoffile(_:).md)
