// The synthetic household previews and the package's tests draw: the kit's// tables as a database that imported them answers them// (`Resources/Fixtures/catalogue.json`, decoded by the core), and its records// (`Resources/Fixtures/<id>.json`). A database never draws these.//// Read through `CottonUIResources.bundle`, never `Bundle.module` directly: the Mac// finds the bundle by path (`Resources.swift`).importCottonKitimportCottonValuesimportFoundationpublicenumFixtureDefinitions {/// The synthetic household's tables, sorted by id, as the core decoded/// them; `failures` names any this build cannot draw.publicstaticfunc load() -> (definitions: [TableDefinition], failures: [String]) { load(from: CottonUIResources.bundle) }/// The synthetic household's tables as `bundle` holds them. Empty when the/// bundle carries none; a fixture this build cannot read is named in/// `failures`.staticfunc load(from bundle: Bundle?) -> (definitions: [TableDefinition], failures: [String]) {do {guardlet fixture = tryDefinitionCatalogue.fixture(in: bundle) else { return ([], []) }return (fixture.tables, fixture.failures) } catch {return ([], ["\(error)"]) } }/// The synthetic records for one table, or none.publicstaticfunc fixtureRecords(for table: String) throws -> [TableRecord] {try fixtureRecords(for: table, bundle: CottonUIResources.bundle) }staticfunc fixtureRecords(for table: String, bundle: Bundle?) throws -> [TableRecord] {guardlet url = bundle?.url(forResource: table, withExtension: "json", subdirectory: "Fixtures") else { return [] }returntry JSONDecoder().decode([TableRecord].self, from: readBundledJSON(url)) }/// Bundled JSON is bounded; refuse a packaging error before buffering a large file./// The fixture catalogue — every kit table in one answer — is the one/// bigger file and passes its own bound.staticfunc readBundledJSON(_ url: URL, limit: Int = 1_048_576) throws -> Data {tryBundledJSON.read(url, limit: limit) }}