{"id":36953944,"url":"https://github.com/gibachan/swift-fixtures","last_synced_at":"2026-01-28T13:08:23.461Z","repository":{"id":328106306,"uuid":"1111059194","full_name":"gibachan/swift-fixtures","owner":"gibachan","description":"A Swift macro library that generates fixtures for value types to simplify unit test writing","archived":false,"fork":false,"pushed_at":"2025-12-21T05:00:17.000Z","size":56,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-22T14:47:20.125Z","etag":null,"topics":["fixture","swift","swift-macro","testing"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gibachan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-06T07:23:45.000Z","updated_at":"2025-12-21T05:00:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gibachan/swift-fixtures","commit_stats":null,"previous_names":["gibachan/swift-fixtures"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/gibachan/swift-fixtures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gibachan%2Fswift-fixtures","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gibachan%2Fswift-fixtures/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gibachan%2Fswift-fixtures/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gibachan%2Fswift-fixtures/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gibachan","download_url":"https://codeload.github.com/gibachan/swift-fixtures/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gibachan%2Fswift-fixtures/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28385689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T12:01:30.995Z","status":"ssl_error","status_checked_at":"2026-01-13T12:00:09.625Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fixture","swift","swift-macro","testing"],"created_at":"2026-01-13T12:54:33.262Z","updated_at":"2026-01-28T13:08:23.452Z","avatar_url":"https://github.com/gibachan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swift-fixtures\n\n![CI](https://github.com/gibachan/swift-fixtures/workflows/CI/badge.svg)\n![Swift 5.9+](https://img.shields.io/badge/Swift-5.9%2B-orange.svg)\n![SPM Compatible](https://img.shields.io/badge/SPM-compatible-brightgreen.svg)\n![License](https://img.shields.io/badge/License-MIT-blue.svg)\n\nA Swift package that simplifies unit test writing by providing fixtures for Swift value types through a macro system.\n\n## Motivation\n\nWhen writing unit tests, you often need to create model objects that are not the focus of your test logic. This library helps you generate these objects easily with `.fixture`, allowing you to focus on what you're actually testing rather than spending time on boilerplate object creation.\n\nThe `@Fixture` macro generates fixture methods for structs and enums, making test data creation simple and consistent.\n\n## Installation\n\nAdd swift-fixtures to your project using Swift Package Manager:\n\n```swift\n// Package.swift\ndependencies: [\n    .package(url: \"https://github.com/gibachan/swift-fixtures.git\", from: \"0.4.0\")\n],\ntargets: [\n    .target(\n        name: \"YourTarget\",\n        dependencies: [\n            .product(name: \"Fixtures\", package: \"swift-fixtures\")\n        ]\n    )\n]\n```\n\n## Features\n\n- ✅ **Struct fixtures** - Generate `.fixture` static property and customizable initializers\n- ✅ **Enum fixtures** - Generate fixtures for enum types\n- ✅ **Builder pattern** - Customize properties using closures: `Type.fixture { $0.property = value }`\n- ✅ **Nested types** - Support for nested structs and enums\n- ✅ **Standard type support** - 15+ pre-built fixtures for common types (String, Int, Date, URL, UUID, Arrays, etc.)\n- ✅ **Type safety** - Recursive fixture generation for custom types conforming to `Fixtureable`\n- ✅ **Debug-only code** - Fixture code is excluded from release builds using `#if DEBUG`\n- ❌ **Class support** - Classes (reference types) are not supported\n- 🚧 **Actor support** - Actors are not yet supported\n\n## Usage\n\n```swift\n@Fixture\nstruct User {\n  let id: String\n  let name: String\n  var age: Int\n\n  @Fixture\n  enum Role {\n    case guest\n    case user(name: String)\n    case admin(id: String, permissions: [String])\n  }\n  var role: Role\n}\n\n// Generate fixture with default values\nlet user: User = .fixture\n// User(id: \"a\", name: \"a\", age: 1, role: .guest)\n\n// Customize specific properties\nlet bob = User.fixture {\n  $0.name = \"Bob\"\n  $0.age = 30\n  $0.role = .admin(id: \"admin123\", permissions: [\"read\", \"write\"])\n}\n// User(id: \"a\", name: \"Bob\", age: 30, role: .admin(id: \"admin123\", permissions: [\"read\", \"write\"]))\n```\n\n## External Library Types\n\nThe `@Fixture` macro can only be applied to types you define. For types from external libraries, you can manually conform to `Fixtureable`:\n\n```swift\nimport ExternalLibrary\nimport Fixtures\n\nextension ExternalType: Fixtureable {\n    static var fixture: Self {\n        ExternalType(\n            name: .fixture,\n            value: .fixture\n        )\n    }\n}\n\n// Now you can use .fixture with external types\nlet external: ExternalType = .fixture\n```\n\n## Documentation\n\nFull DocC documentation is available:\n\n- **Online**: [Swift Package Index](https://swiftpackageindex.com/gibachan/swift-fixtures/documentation) (automatically updated)\n- **Local Generation**:\n  ```bash\n  # Generate and open documentation\n  ./scripts/generate-docs.sh\n\n  # Or using swift-docc-plugin\n  swift package generate-documentation --target Fixtures\n\n  # Or manually with xcodebuild\n  xcodebuild docbuild -scheme Fixtures -destination 'platform=macOS'\n  ```\n\n## Development\n\n```bash\nmake build    # Build project\nmake test     # Run tests\nmake format   # Format code\nmake lint     # Lint code\nmake clean    # Clean build artifacts\nmake help     # Show all commands\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgibachan%2Fswift-fixtures","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgibachan%2Fswift-fixtures","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgibachan%2Fswift-fixtures/lists"}