{"id":32146652,"url":"https://github.com/stansmida/swift-conformable-existential","last_synced_at":"2025-10-21T08:19:35.674Z","repository":{"id":211683049,"uuid":"717519283","full_name":"stansmida/swift-conformable-existential","owner":"stansmida","description":"Hashable and Codable support for existential types","archived":false,"fork":false,"pushed_at":"2025-09-16T10:22:28.000Z","size":486,"stargazers_count":4,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-18T09:55:18.640Z","etag":null,"topics":["codable","existential","hashable","swift"],"latest_commit_sha":null,"homepage":"http://stansmida.github.io/swift-conformable-existential/documentation/swiftconformableexistential","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/stansmida.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}},"created_at":"2023-11-11T17:57:23.000Z","updated_at":"2025-10-01T14:52:02.000Z","dependencies_parsed_at":"2024-01-26T13:40:15.473Z","dependency_job_id":"83b9dcb3-e65b-4ea7-8b89-a41d355477c1","html_url":"https://github.com/stansmida/swift-conformable-existential","commit_stats":null,"previous_names":["stansmida/swift-conformable-existential"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/stansmida/swift-conformable-existential","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stansmida%2Fswift-conformable-existential","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stansmida%2Fswift-conformable-existential/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stansmida%2Fswift-conformable-existential/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stansmida%2Fswift-conformable-existential/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stansmida","download_url":"https://codeload.github.com/stansmida/swift-conformable-existential/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stansmida%2Fswift-conformable-existential/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280226283,"owners_count":26293993,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["codable","existential","hashable","swift"],"created_at":"2025-10-21T08:19:33.230Z","updated_at":"2025-10-21T08:19:35.659Z","avatar_url":"https://github.com/stansmida.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftConformableExistential\n\nA set of Swift Macros designed to facilitate the conformance of existential types to\n`Equatable`, `Hashable`, `Decodable`, `Encodable`, and `Codable`.\n\n\n## Overview\n\nUntil Swift gains support for [extending existential types](https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md#extending-existential-types),\nthey cannot satisfy generic constraints on their own.\n\n```swift\nprotocol Drinkable: Hashable {}\n\n// Is ill-formed, because `any Drinkable` does not conform to `Hashable`,\n// despite the fact that every `Drinkable` instance does.\nstruct Foo: Hashable {\n    let drinkable: any Drinkable\n}\n```\n\nOvercoming this limitation requires extensive boilerplate code. This package offers a set of macros\nthat can be attached to your protocol to synthesize ready-to-use property wrappers over the existential\ntype of the annotated protocol. These wrappers act as proxies for the respective conformances.\n```swift\nimport SwiftConformableExistential\n\n@HashableExistential\nprotocol Drinkable: Hashable {}\n\n// `HashableDrinkable` is a `Hashable` wrapper over `any Drinkable`,\n// synthesized of the attached `@HashableExistential` macro,\n// allowing the compiler to now synthesize the `Hashable` implementation for `Foo`.\nstruct Foo: Hashable {\n\n    @HashableDrinkable\n    var drinkable: any Drinkable\n}\n```\n\nAlternatively, the wrappers can also be used on-the-fly, particularly in situations where\nemploying property wrappers is not suitable:\n\n```swift\nstruct Tap: View {\n\n    @State private var drinkable: any Drinkable = .smallBeer\n    \n    var body: some View {\n        ...           \n        .onChange(of: HashableDrinkable(drinkable)) { _, newValue in\n            prepareForPouring(newValue.wrappedValue)\n        }\n    }\n}\n```\n\nFor more, see [the documentation](http://stansmida.github.io/swift-conformable-existential/documentation/swiftconformableexistential).\n\n\n## Installation\n\nVia SwiftPM.\n\nIn your package dependencies:\n\n`.package(url: \"https://github.com/stansmida/swift-conformable-existential.git\", from: \"0.4.0\"),`\n\nAnd in your target dependencies:\n\n`.product(name: \"SwiftConformableExistential\", package: \"swift-conformable-existential\"),`\n\nAnd don't forget to import in files where annotating your protocols:\n\n`import SwiftConformableExistential`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstansmida%2Fswift-conformable-existential","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstansmida%2Fswift-conformable-existential","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstansmida%2Fswift-conformable-existential/lists"}