SwiftLintFile

public final class SwiftLintFile
extension SwiftLintFile: Hashable

A unit of Swift source code, either on disk or in memory.

  • Creates a SwiftLintFile with a SourceKitten File.

    Declaration

    Swift

    public init(file: File)

    Parameters

    file

    A file from SourceKitten.

  • Creates a SwiftLintFile by specifying its path on disk. Fails if the file does not exist.

    Declaration

    Swift

    public convenience init?(path: String)

    Parameters

    path

    The path to a file on disk. Relative and absolute paths supported.

  • Creates a SwiftLintFile by specifying its path on disk. Unlike the SwiftLintFile(path:) initializer, this one does not read its contents immediately, but rather traps at runtime when attempting to access its contents.

    Declaration

    Swift

    public convenience init(pathDeferringReading path: String)

    Parameters

    path

    The path to a file on disk. Relative and absolute paths supported.

  • Creates a SwiftLintFile that is not backed by a file on disk by specifying its contents.

    Declaration

    Swift

    public convenience init(contents: String)

    Parameters

    contents

    The contents of the file.

  • The path on disk for this file.

    Declaration

    Swift

    public var path: String? { get }
  • The file’s contents.

    Declaration

    Swift

    public var contents: String { get }
  • A string view into the contents of this file optimized for string manipulation operations.

    Declaration

    Swift

    public var stringView: StringView { get }
  • The parsed lines for this file’s contents.

    Declaration

    Swift

    public var lines: [Line] { get }
  • Invalidates all cached data for this file.

    Declaration

    Swift

    public func invalidateCache()

Hashable Conformance