---
title: extension
framework: system
role: symbol
role_heading: Instance Property
path: system/filepath/component/extension
---

# extension

The extension of this file or directory component.

## Declaration

```swift
var `extension`: String? { get }
```

## Discussion

Discussion If self does not contain a . anywhere, or only at the start, returns nil. Otherwise, returns everything after the dot. Examples: foo.txt    => txt foo.tar.gz => gz Foo.app    => app .hidden    => nil ..         => nil
