Skip to content
cd /languages
  • Apple platforms
  • Programming
  • AST and symbol support

Swift Support in Maguyva: Code Graphs for iOS and macOS

Maguyva parses Swift with AST, symbol, and graph support, so AI agents can follow protocols, extensions, initializers, and observers in iOS and macOS code.

Swift spreads one type across many places. A struct is declared in one file, gains behaviour from extensions in three others, and conforms to protocols defined in a package. State changes hide in computed properties and willSet / didSet observers. An agent reading files one at a time misses most of that.

Maguyva indexes the structure, so an agent can see a type’s members, conformances, and callers together.

What Maguyva extracts in Swift

Maguyva covers .swift. Callable symbols include functions, init and deinit, subscripts, computed getters and setters, and willSet / didSet observers, so state-changing code is searchable as symbols rather than buried in property bodies.

Members declared inside structs, enums, protocols, and extensions are qualified by their owning type (for example CartStore.add), and members added in an extension are attributed to the extended type. Definition names have generic parameters, protocol conformance lists, and ? / ! suffixes stripped, so lookups use the plain name. Calls keep self. and class qualification, and trailing closures count toward call arity.

The graph records calls, protocol conformance, inheritance, overrides, instantiation, attributes, type references, reads and writes, and throw edges.

Example agent prompts

  • “Which types conform to PaymentProvider, and where is each one created?” (dependency_search)
  • “Who calls CartStore.add, and from which views?” (find_symbol, then dependency_search incoming)
  • “Explain how a push notification reaches the inbox screen.” (get_task_context)

Known limits

  • Only .swift source is mapped. Storyboard and XIB files are not in the extension list, so Interface Builder connections are outside the graph.
  • Standard-library and Foundation calls such as print, debugPrint, NSLog, and assertions are filtered from relationships, so they are not graph edges. Use text_pattern_search for them.

Next steps

Connect a repository with the quickstart, then check the support matrix on the compatibility page. If you ship the same product on Android, read the Kotlin guide.

Best fit

  • > iOS and macOS teams with large app targets and shared Swift packages.
  • > Codebases built around protocols and extensions, where a type's behaviour is spread across many files.
  • > Agent workflows that need impact analysis before changing a shared model, service, or protocol.

Agent workflows

  • > Find every type that conforms to a protocol before changing one of its requirements.
  • > Trace callers of a service method across view models, coordinators, and packages.
  • > Locate initializers, computed properties, and `didSet` observers that touch a piece of state.

Engine details

  • > Callable symbols include functions, `init`, `deinit`, subscripts, computed getters and setters, and `willSet` / `didSet` observers.
  • > Members of structs, enums, protocols, and extensions are qualified by their owning type, such as `CartStore.add`.
  • > Generic parameters, protocol conformance lists, and `?` / `!` suffixes are stripped from definition names, and calls keep `self.` and class qualification.

Useful MCP entry points

  • find_symbol

    Use it for a type, protocol, or method name when you need the definition and references.

  • dependency_search

    Use it on a protocol to find conforming types, or incoming on a method to find callers.

  • get_task_context

    Use it for prompts like “explain how a push notification reaches the inbox screen.”