Query syntax
A query is predicates on the parts of a declaration. Braces step into a part, and every predicate inside one pair of braces is tested against thesame part — so param{ label:completion is:sendable } is one parameter that is both, not two parameters that are one each.
Grammar
field:value- A predicate. Values run to the next space or bracket —
selector:initWithFrame:andqname:Swift.Arrayneed no quotes. word- Free text: names by relevance, by camel-case part (
table cellfindsUITableViewCell) and by prefix. scope{ … }- Step into a part. An empty
thrownmeans the part exists. is:flag- A flag of the current part (
is:static,is:sendable) or its kind (is:func,is:protocol). a b·a AND b·a & b- Both.
a | b·a OR b- Either.
-a·!a·NOT a- Not. Inside a scope,
param{ -is:escaping }is a parameter that is not escaping; outside,-param{ is:escaping }is no escaping parameter at all. ( … )- Grouping, at any level.
Values
name:View- Exact, case-insensitive.
name:*Delegate- Wildcards:
*and?. name:"table view"- A phrase of camel-case parts.
name:~cell- Contains the part “cell”.
name:/UI.*Cell/- A regular expression over the whole value.
pos:>1·pos:1..3- Numbers compare and take ranges.
Type patterns
Shorthand fields — returns:, takes:, where:, mentions:, and like: on any type — take a Swift type with holes, and expand to the structural query you would otherwise write by hand.
_- Any type.
$T- A variable: the same type everywhere
$Tappears in the query. Name·Module.Name·*Delegate- A type by name.
*is a wildcard. Name<A, _>- Generic arguments, in order.
T?·[T]·[K: V]- Optional, Array and Dictionary, written either way.
(A, b: B)·()·Void- A tuple, with labels; the empty tuple.
@Sendable (A) async throws -> R- A function type. Attributes, effects, labels and the number of parameters all count;
(...)leaves the parameters open. some P & Q·any P·T.Type- Opaque, existential and metatype.
Variables
req{ subject{ $T } constraint{ name:Hashable } } param{ type{ $T } } is one type that is both constrained to Hashable and taken as a parameter. A variable binds to a node’s qualified type; under - it must already be bound.
Examples
ViewA name, by relevancekind:ivar name:*bodyInstance variables whose name ends in “body”is:func req{ constraint{ name:Hashable } }Generic functions with a requirement on Hashableparam{ is:closure is:sendable is:async }Takes an @Sendable async closure — one parameter, both at onceresult{ is:opaque member{ name:View } }Returns some Viewkind:method param{ is:block param{ name:NSError } }ObjC methods taking a block that receives an NSErrortakes:"(Result<_, Error>) -> Void"Takes a completion handler — written as the Swift type, with _ for “anything”returns:"some View" is:staticStatic members that return some Viewreq{ subject{ $T } constraint{ name:Hashable } } returns:"[$T]"Returns an array of the very type it requires to be Hashableresult{ name:Dictionary arg{ pos:1 deep{ is:closure } } }A Dictionary whose value type contains a closurekind:ivar offset:>=0x200 in:UIViewUIView’s ivars at or beyond 512 bytes into the instanceis:objc kind:property mod:copy -mod:readonly result{ name:NSString }Writable copy NSString propertiesis:struct inherits{ name:Sendable } inherits{ name:Hashable } is:public size:>64Public Sendable, Hashable structs over 64 bytes
At the top: a declaration
A declaration: a type, protocol, extension or category, or one of their members
| Field | Means |
|---|---|
kind: | struct, class, enum, actor, protocol, extension, category, func, init, var, subscript, case, field, associatedtype, typealias, deinit, method, property, ivar |
lang:language: | swift or objc |
module: | The image’s module: UIKitCore, SwiftUI |
image: | The image’s install path (wildcards welcome) |
build: | The OS build: 24A446 |
name: | Bare name: body, initWithFrame: |
qname:qualifiedName: | Qualified name: SwiftUI.View.body |
in: | The enclosing container’s name |
mod:modifier:modifiers: | Keywords: static, final, override, mutating, nonatomic, copy, readonly, … |
attr:attribute:attributes: | @objc, @propertyWrapper, @resultBuilder, @globalActor, @retroactive, @Observable, … |
accessor: | get, set, modify, read, init |
selector:sel: | ObjC selector: initWithFrame: |
encoding: | ObjC type encoding |
category: | The class an ObjC category extends |
conforms:conformsTo: | The protocol a conformance extension conforms to |
mangled: | The Swift mangled name |
vtable: | A class method’s vtable offset |
offset: | A stored property’s or ivar’s byte offset: offset:>=0x40 |
size: | A type’s instance size in bytes (Swift: computed statically; ObjC: instanceSize) |
stride: | A Swift type’s stride in bytes |
align: | A Swift type’s alignment in bytes |
address: | The implementation’s unslid address in the shared cache: address:0x1a93bf9c8 |
decl:signature:display: | The declaration as written |
returns:shorthand | The result matches a type pattern: returns:"some View", returns:Bool? |
takes:shorthand | Some parameter’s type matches a pattern: takes:"(Result<_, Error>) -> Void" |
where:shorthand | A generic requirement’s constraint matches: where:Hashable |
mentions:shorthand | The type appears anywhere in the signature, at any depth: mentions:"[String: Any]" |
actor:shorthand | A closure in the signature is isolated to this global actor: actor:MainActor |
conformsTo:shorthand | A type or extension conforms to, inherits from or adopts: conformsTo:Sendable |
| Flag | Means |
|---|---|
is:static | static / class member |
is:exported | Its symbol is exported |
is:override | Overrides a superclass member |
is:final | final |
is:optional | An @optional ObjC requirement |
is:async | async |
is:throws | throws |
is:container | A type, protocol, extension or category |
is:member | A member of a container |
is:swift | Swift |
is:objc | Objective-C |
is:generic | Has generic parameters |
is:public | In a public framework |
is:safeCategoryPlaceholder | An accessibility bundle’s empty __FooAccessibility_super class: the placeholder FooAccessibility inherits from, re-pointed at Foo at load |
is:accessibility | In an accessibility bundle |
is:private | In a private framework |
is:mainactor | A closure in the signature is @MainActor (a method’s own isolation is not in the binary) |
is:sendableClosure | Takes a @Sendable closure |
is:callback | Takes an escaping closure that returns Void — a completion handler |
is:property | A property: Swift var or field, or ObjC property |
is:method | A method: Swift func or ObjC method |
is:type | A type: struct, class, enum or actor (either language) |
is:<kind> | struct, class, enum, actor, protocol, extension, category, func, init, var, subscript, case, field, associatedtype, typealias, deinit, method, property, ivar |
| Part | Steps into |
|---|---|
param{}parameter{}params{} | A parameter |
req{}requirement{}where{} | A generic requirement |
generic{} | A generic parameter |
inherits{}super{}inherit{}conformances{} | A superclass, adopted protocol or conformance |
result{}returns{}value{}type{} | The result: a function’s return type, a property’s or field’s type, an enum case’s payload |
thrown{} | The typed-throws error type |
extends{}extended{} | The type an extension or category extends |
parent{} | The enclosing container |
any{}anywhere{}mentions{} | Any type node anywhere in the signature |
paramreached by param{}
A parameter of a function, initializer, subscript or method. Unknown fields apply to its type.
| Field | Means |
|---|---|
pos:position: | Position (0-based) |
label: | Argument label; for ObjC, the selector piece without its colon |
name: | The parameter’s own name (ObjC) |
piece: | ObjC selector piece: initWithFrame: |
| Part | Steps into |
|---|---|
type{} | The parameter’s type |
Fields and flags this part does not have apply to its type{}.
typereached by type{}child{}arg{}param{}returns{}thrown{}actor{}member{}base{}element{}deep{}subject{}constraint{}inherits{}result{}extends{}
A type: a node of a signature’s type tree
| Field | Means |
|---|---|
kind: | What the node is: nominal, genericParameter, associatedType, function, tuple, existential, opaque, metatype, pack, packExpansion, builtin, selfType, unknown |
role: | What the node is to its parent: genericArgument, parameter, result, thrownError, element, base, member, globalActor |
pos:position: | Position among siblings of the same role (0-based) |
label: | A closure parameter’s or tuple element’s label |
name: | Bare name: Array, A, Element, NSString |
module: | The module a nominal type is declared in |
qname:qualifiedName: | Qualified name: Swift.Array, Foundation.Data |
nominal:nominalKind: | A nominal’s kind: struct, class, enum, protocol, typealias, union |
sugar: | optional, array or dictionary when written with sugar |
convention: | A function type’s convention: block, c, thin |
ownership: | borrowing or consuming |
attr:attribute:attributes: | Attributes on the node: @Sendable, @escaping, @MainActor, nullable, … |
pointers: | Levels of * on an ObjC / C type |
type: | The type as written |
like:shorthand | This node matches a type pattern: param{ like:"@escaping (Bool) -> Void" } |
takes:shorthand | A function type with a parameter matching a pattern |
returns:shorthand | A function type whose result matches a pattern |
| Flag | Means |
|---|---|
is:sendable | @Sendable function type |
is:escaping | @escaping function type |
is:autoclosure | @autoclosure |
is:async | async function type |
is:throws | throwing function type |
is:inout | inout parameter |
is:variadic | variadic parameter |
is:isolated | isolated parameter |
is:sending | sending parameter |
is:isolatedAny | @isolated(any) function type |
is:optional | Optional, written either way |
is:generic | A generic parameter |
is:closure | A function type of any convention |
is:block | An Objective-C block |
is:<kind> | nominal, genericParameter, associatedType, function, tuple, existential, opaque, metatype, pack, packExpansion, builtin, selfType, unknown, struct, class, enum, protocol, typealias, union |
| Part | Steps into |
|---|---|
child{}children{} | Any direct child node |
arg{}args{}argument{} | A generic argument |
param{}parameter{}params{} | A function type’s parameter |
returns{} | A function type’s result |
thrown{} | A function type’s thrown error |
actor{} | A function type’s global actor |
member{}members{} | A protocol of an existential or opaque type |
base{} | What an associated type or metatype is reached from |
element{} | A tuple or pack element |
deep{}descendant{} | Any node below this one, at any depth |
reqreached by req{}
A generic requirement (`where` clause). Unknown fields apply to its constraint.
| Field | Means |
|---|---|
kind: | conformance, superclass, sameType, layout, inverse, sameShape |
layout: | A layout requirement’s layout: AnyObject, _Trivial, … |
text: | The requirement as written: A: Hashable |
| Flag | Means |
|---|---|
is:conformance | A: P |
is:superclass | A: SomeClass |
is:sameType | A.Element == B |
is:layout | A: AnyObject |
is:inverse | A: ~Copyable |
| Part | Steps into |
|---|---|
subject{} | The constrained side: A, A.Element |
constraint{} | The constraining side: the protocol, class or type |
Fields and flags this part does not have apply to its constraint{}.
genericreached by generic{}
A generic parameter (the binary keeps no source names: A, B, A1, …)
| Field | Means |
|---|---|
name: | A, B, A1 |
depth: | Nesting depth: 0 for the outermost generic context |
index: | Index within its depth |
| Flag | Means |
|---|---|
is:own | Declared by this declaration, not an enclosing one |
parentreached by parent{}
The declaration’s enclosing container
| Field | Means |
|---|---|
kind: | struct, class, protocol, extension, category, … |
name: | UIView |
qname:qualifiedName: | SwiftUI.View |
anywherereached by any{}
Any type node anywhere in the declaration’s signature
| Field | Means |
|---|---|
kind: | What the node is: nominal, genericParameter, associatedType, function, tuple, existential, opaque, metatype, pack, packExpansion, builtin, selfType, unknown |
role: | What the node is to its parent: genericArgument, parameter, result, thrownError, element, base, member, globalActor |
label: | A closure parameter’s or tuple element’s label |
name: | Bare name: Array, A, Element, NSString |
module: | The module a nominal type is declared in |
qname:qualifiedName: | Qualified name: Swift.Array, Foundation.Data |
nominal:nominalKind: | A nominal’s kind: struct, class, enum, protocol, typealias, union |
attr:attribute:attributes: | Attributes on the node: @Sendable, @escaping, @MainActor, nullable, … |
type: | The type as written |
path: | Where the node sits: parameters[0]/genericArgument[1], result, requirements[2]/constraint |
depth: | How deep below its tree’s root |
| Flag | Means |
|---|---|
is:sendable | @Sendable function type |
is:escaping | @escaping function type |
is:async | async function type |
is:throws | throwing function type |
is:inout | inout parameter |
is:variadic | variadic parameter |
is:generic | A generic parameter |
is:closure | A function type of any convention |
is:<kind> | nominal, genericParameter, associatedType, function, tuple, existential, opaque, metatype, pack, packExpansion, builtin, selfType, unknown, struct, class, enum, protocol, typealias, union |
Limits
- The index maps type trees 5 levels deep. A query that reaches deeper, or uses a variable, is answered in two steps — the index narrows, then each candidate is checked exactly — and says so beside the count. It is exact, but a broad one may stop at its scan budget.
- Binaries keep no generic parameter names: they are
A,B,A1by depth and position. - Not in the binary at all, so not searchable: a method’s own
@MainActor(a closure type’s global actor is —actor:MainActor),@available, Swift parameter names, default argument values, doc comments. - Field offsets are computed statically and left out where a generic parameter’s layout moves them. ObjC ivar offsets come from
class_ro_t; a Swift class’s ivars there are filled in at runtime and have none.