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

# moduleName

The name of the module containing the source file.

```
var moduleName: String { get }
```

## Discussion

The name of the module is derived from this instance’s [`fileID`](/documentation/Testing/SourceLocation/fileID)
property. It consists of the substring of the file ID up to the first
forward-slash character (`"/"`.) For example, if the value of this
instance’s [`fileID`](/documentation/Testing/SourceLocation/fileID) property is `"FoodTruck/WheelTests.swift"`, the
module name is `"FoodTruck"`.

The structure of file IDs is described in the documentation for the
[`#fileID`](https://developer.apple.com/documentation/swift/fileID())
macro in the Swift standard library.

## See Also

[`fileID`](/documentation/Testing/SourceLocation/fileID)

The file ID of the source file.

[`fileName`](/documentation/Testing/SourceLocation/fileName)

The name of the source file.

  [`#fileID`](https://developer.apple.com/documentation/swift/fileID())



---

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)