Trellis

Swift source navigation

Bring Swift types, named functions and their source relationships into the graph your agents query.

Swift source navigation can use the same graph and agent interface as the team's other sources.

Trellis reads .swift files without compiling or running your project. Follow source locations and relationships between types and named functions, alongside the other sources you have added.

From a protocol to its source

Classes, structs, enums and actors become type symbols. Protocols and named functions have their own source locations. Simple extensions can attach members to an unambiguous type in the same repository.

protocol Printable {
  func render()
}

struct Widget: Printable {
  func render() { format() }
}

func format() {}

extension Widget {
  func preview() { render() }
}

In this example, Widget implements Printable. The call to format inside Widget.render is recorded but remains unresolved. The extension adds Widget.preview, whose call connects to Widget.render.

These relationships come from source syntax. They help you navigate the code; they do not establish the complete set of calls a running application will make.

Add Swift files

Enable code ingestion for your repository and select Swift in Sources. Check that the repository's saved include patterns cover **/*.swift. Selecting the language does not expand an existing list of file patterns.

What syntax analysis leaves out

  • No complete compiler call graph or type inference. Calls can remain unresolved, and overloads with the same owner and name in one file share a symbol.
  • No SwiftPM or Xcode build resolution. Imports such as Foundation stay external; type aliases are not expanded.
  • No macro expansion or Swift framework route detection.
  • Qualified, constrained and specialized extensions are omitted, including their members and calls.
  • Initializers, deinitializers, properties and subscripts do not become callable symbols, and their own calls are omitted. Calls in closures belong to the enclosing named function.

Use the graph alongside your compiler and tests. The Swift guide explains discovery, supported declarations and unresolved relationships.