{"id":32150984,"url":"https://github.com/bernndr/swift-macros","last_synced_at":"2026-02-21T15:02:22.180Z","repository":{"id":208478266,"uuid":"721542757","full_name":"bernndr/swift-macros","owner":"bernndr","description":"Collection of useful macros","archived":false,"fork":false,"pushed_at":"2025-10-06T10:38:15.000Z","size":43,"stargazers_count":34,"open_issues_count":1,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-18T09:24:44.358Z","etag":null,"topics":["swift","swift-macros","swift-package","swift-package-manager","swift5-9","xcode","xcode15"],"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/bernndr.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":"2023-11-21T09:27:03.000Z","updated_at":"2025-10-06T10:34:47.000Z","dependencies_parsed_at":"2023-11-21T18:26:45.514Z","dependency_job_id":"889c2ef6-39bb-44cc-922d-04cf20777118","html_url":"https://github.com/bernndr/swift-macros","commit_stats":null,"previous_names":["bernndr/swift-macros"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/bernndr/swift-macros","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernndr%2Fswift-macros","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernndr%2Fswift-macros/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernndr%2Fswift-macros/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernndr%2Fswift-macros/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bernndr","download_url":"https://codeload.github.com/bernndr/swift-macros/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bernndr%2Fswift-macros/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29684075,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T14:31:22.911Z","status":"ssl_error","status_checked_at":"2026-02-21T14:31:22.570Z","response_time":107,"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":["swift","swift-macros","swift-package","swift-package-manager","swift5-9","xcode","xcode15"],"created_at":"2025-10-21T10:31:13.631Z","updated_at":"2026-02-21T15:02:22.173Z","avatar_url":"https://github.com/bernndr.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swift Macros\nContains a collection of useful macros for my personal projects.\n\n## Usage\n### Symbol\n```swift\nlet symbol = #symbol(\"swift\") // Macro expands to \"swift\"\n```\n\u003e In case the provided value is not a valid SF Symbol, Xcode will show a compile error.\n\n### URL\n```swift\nlet url = #URL(\"https://www.swift.org\") // Macro expands to URL(string: \"https://www.swift.org\")!\n```\n\u003e In case the provided value is not a valid URL, Xcode will show a compile error.\n\n### AssociatedValues\nAdd variables to retrieve the associated values.\n\n```swift\n@AssociatedValues\nenum Barcode {\n  case upc(Int, Int, Int, Int)\n  case qrCode(String)\n}\n\n// Expands to\nenum Barcode {\n  ...\n\n  var upcValue: (Int, Int, Int, Int)? {\n    if case let .upc(v0, v1, v2, v3) = self {\n        return (v0, v1, v2, v3)\n    }\n    return nil\n  }\n\n  var qrCodeValue: (String)? {\n    if case let .qrCode(v0) = self {\n        return v0\n    }\n    return nil\n  }\n}\n```\n\n### Singleton\nGenerate singleton code for struct and class\n\n```swift\n@Singleton\nstruct UserStore {\n}\n\n// Expands to\nstruct UserStore {\n  static let shared = UserStore()\n\n  private init() {\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernndr%2Fswift-macros","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbernndr%2Fswift-macros","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbernndr%2Fswift-macros/lists"}