<!--
{
  "availability" : [
    "Xcode: 16.0.0 -",
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "macOS: -",
    "swift: 6.0.0 -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/SourceLocation",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing14SourceLocationV"
  },
  "title" : "SourceLocation"
}
-->

# SourceLocation

A type representing a location in source code.

```
struct SourceLocation
```

## Topics

### Initializers

[`init(fileID: String, filePath: String, line: Int, column: Int)`](/documentation/Testing/SourceLocation/init(fileID:filePath:line:column:))

Initialize an instance of this type with the specified location details.

### Instance Properties

[`var column: Int`](/documentation/Testing/SourceLocation/column)

The column in the source file.

[`var fileID: String`](/documentation/Testing/SourceLocation/fileID)

The file ID of the source file.

[`var fileName: String`](/documentation/Testing/SourceLocation/fileName)

The name of the source file.

[`var filePath: String`](/documentation/Testing/SourceLocation/filePath)

The path to the source file.

[`var line: Int`](/documentation/Testing/SourceLocation/line)

The line in the source file.

[`var moduleName: String`](/documentation/Testing/SourceLocation/moduleName)

The name of the module containing the source file.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

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

---

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)