Location
public struct Location : CustomStringConvertible, Comparable, Codable, Sendable
The placement of a segment of Swift in a collection of source files.
-
The file path on disk for this location.
Declaration
Swift
public let file: String? -
The line offset in the file for this location. 1-indexed.
Declaration
Swift
public let line: Int? -
The character offset in the file for this location. 1-indexed.
Declaration
Swift
public let character: Int? -
A lossless printable description of this location.
Declaration
Swift
public var description: String { get } -
The file path for this location relative to the current working directory.
Declaration
Swift
public var relativeFile: String? { get } -
Creates a
Locationby specifying its properties directly.Declaration
Swift
public init(file: String?, line: Int? = nil, character: Int? = nil)Parameters
fileThe file path on disk for this location.
lineThe line offset in the file for this location. 1-indexed.
characterThe character offset in the file for this location. 1-indexed.
-
Creates a
Locationbased on aSwiftLintFileand a byte-offset into the file. Fails if the specified offset was not a valid location in the file.Declaration
Swift
public init(file: SwiftLintFile, byteOffset offset: ByteCount)Parameters
fileThe file for this location.
offsetThe offset in bytes into the file for this location.
-
Creates a
Locationbased on aSwiftLintFileand a SwiftSyntaxAbsolutePositioninto the file. Fails if the specified offset was not a valid location in the file.Declaration
Swift
public init(file: SwiftLintFile, position: AbsolutePosition)Parameters
fileThe file for this location.
positionThe absolute position returned from SwiftSyntax.
-
Creates a
Locationbased on aSwiftLintFileand a UTF8 character-offset into the file. Fails if the specified offset was not a valid location in the file.Declaration
Swift
public init(file: SwiftLintFile, characterOffset offset: Int)Parameters
fileThe file for this location.
offsetThe offset in UTF8 fragments into the file for this location.
-
Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool
View on GitHub
Install in Dash