SwiftInfo

public struct SwiftInfo

The base API for SwiftInfo operations.

  • The information about the current project.

    Declaration

    Swift

    public let projectInfo: ProjectInfo
  • Utilities for opening and saving files.

    Declaration

    Swift

    public let fileUtils: FileUtils
  • A HTTP Client that sends synchronous POST requests.

    Declaration

    Swift

    public let client: HTTPClient
  • An instance of SourceKit.

    Declaration

    Swift

    public let sourceKit: SourceKit
  • Undocumented

    Declaration

    Swift

    public init(projectInfo: ProjectInfo,
                fileUtils: FileUtils = .init(),
                slackFormatter: SlackFormatter = .init(),
                client: HTTPClient = .init(),
                sourceKit: SourceKit? = nil)
  • Executes a provider with an optional set of additional arguments.

    Declaration

    Swift

    public func extract<T: InfoProvider>(_ provider: T.Type,
                                         args: T.Arguments? = nil) -> Output

    Parameters

    provider

    The provider metatype to execute.

    args

    (Optional) The arguments to send to the provider, if applicable.

    Return Value

    The output of this provider.

  • Sends an output to slack.

    Declaration

    Swift

    public func sendToSlack(output: Output, webhookUrl: String, titlePrefix: String? = nil)

    Parameters

    output

    The output to send.

    webhookUrl

    The Slack webhook URL used to send the message.

    titlePrefix

    (Optional) The string to prepend to the message title such as team-mention, etc.

  • Uses the SlackFormatter to format the output and print it.

    Declaration

    Swift

    public func print(output: Output)
  • Saves the current output to the device.

    Declaration

    Swift

    public func save(output: Output,
                     timestamp: TimeInterval = Date().timeIntervalSince1970)

    Parameters

    output

    The output to save. The file will be saved as {Infofile path}/SwiftInfo-output.json.

    timestamp

    (Optional) A custom timestamp for the output.