{"id":15683522,"url":"https://github.com/simonbs/proxymacro","last_synced_at":"2025-05-07T13:05:04.364Z","repository":{"id":206874248,"uuid":"717885431","full_name":"simonbs/ProxyMacro","owner":"simonbs","description":"Swift macro that proxies a value from one object to another.","archived":false,"fork":false,"pushed_at":"2024-12-09T11:55:41.000Z","size":20,"stargazers_count":13,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-07T13:05:00.446Z","etag":null,"topics":["swift","swift-macro","swift-macros","swiftmacro","swiftmacros"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonbs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-11-12T22:08:57.000Z","updated_at":"2025-01-09T19:00:57.000Z","dependencies_parsed_at":"2025-03-11T05:42:11.889Z","dependency_job_id":null,"html_url":"https://github.com/simonbs/ProxyMacro","commit_stats":null,"previous_names":["simonbs/proxymacro"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FProxyMacro","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FProxyMacro/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FProxyMacro/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonbs%2FProxyMacro/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonbs","download_url":"https://codeload.github.com/simonbs/ProxyMacro/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252883222,"owners_count":21819159,"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","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-macro","swift-macros","swiftmacro","swiftmacros"],"created_at":"2024-10-03T17:06:40.189Z","updated_at":"2025-05-07T13:05:04.338Z","avatar_url":"https://github.com/simonbs.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ProxyMacro\n\nSwift macro that proxies a property from one object to another.\n\n```swift\nfinal class MyObj {\n    private final class StateStore {\n      var number = 42\n    }\n\n    @Proxy(\\Self.stateStore.number)\n    var number: Int\n\n    private let stateStore = StateStore()\n}\n```\n\nThis is useful when state needs to be kept in sync between multiple objects but we do not want to forward the state using `willSet`/`didSet`. In this case we pass the state store to the children instead. We can still expose the `number` property on `MyObj` and any reads and writes will be forwarded to the `number` propety on `StateStore`.\n\n```swift\nfinal class MyObj {\n    private final class StateStore {\n      var number = 42\n    }\n\n    @Proxy(\\Self.stateStore.number)\n    var number: Int\n\n    private let stateStore = StateStore()\n    private lazy var childA = Child(stateStore: stateStore)\n    private lazy var childB = Child(stateStore: stateStore)\n}\n\nfinal class Child {\n    private let stateStore: StateStore\n\n    init(stateStore: StateStore) {\n        self.stateStore = stateStore\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbs%2Fproxymacro","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonbs%2Fproxymacro","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonbs%2Fproxymacro/lists"}