<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "XCTest",
  "identifier" : "/documentation/XCTest/XCTSourceCodeLocation/init(filePath:lineNumber:)-3hzmr",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "XCTest"
    ],
    "preciseIdentifier" : "c:objc(cs)XCTSourceCodeLocation(im)initWithFilePath:lineNumber:"
  },
  "title" : "init(filePath:lineNumber:)"
}
-->

# init(filePath:lineNumber:)

Initializes a new instance with a file path and a line number.

```
convenience init(filePath: String, lineNumber: Int)
```

## Parameters

`filePath`

A string that represents a file path to the source code file.

`lineNumber`

An integer that represents a line of code in the source code file.

---

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)