Swift Scenarios
A query ends with comment, purpose, and the single context argument:
let people = try await Q.people()
.withNameContaining("Ada")
.comment("support search")
.purpose("find matching people")
.executeForList(context)
people is a SmartList<Person>: it has normal Swift collection behavior and preserves TeaQL
totals, aggregations, summaries, facets, and loaded state for compatible queries.
A mutation starts from a purpose-bearing generated request and saves with a non-blank audit reason. Keep the returned entity because it contains persistence results such as generated identity and the new version while preserving loaded/null/not-loaded state:
var person = try await Q.people().purpose("create person").newEntity(context)
person = person.updateName("Ada")
let saved = try await person.auditAs("create approved person").save(context)
Use generated constants and predicates rather than hard-coded identifiers. The exact generated method names remain the source of truth for the selected model.