{"id":20529663,"url":"https://github.com/amzd/publishedobject","last_synced_at":"2025-06-19T17:40:25.426Z","repository":{"id":54713359,"uuid":"281068946","full_name":"Amzd/PublishedObject","owner":"Amzd","description":"A property wrapper that forwards the objectWillChange of the wrapped ObservableObject to the enclosing ObservableObject's objectWillChange.","archived":false,"fork":false,"pushed_at":"2024-10-05T06:15:59.000Z","size":29,"stargazers_count":34,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T11:06:26.939Z","etag":null,"topics":["combine","combine-framework","property-wrapper","swift-package-manager","swiftui"],"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/Amzd.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}},"created_at":"2020-07-20T09:09:56.000Z","updated_at":"2025-02-26T02:22:28.000Z","dependencies_parsed_at":"2025-04-14T05:24:59.438Z","dependency_job_id":"dde4999b-6f45-488a-aacc-385726c5b267","html_url":"https://github.com/Amzd/PublishedObject","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/Amzd/PublishedObject","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amzd%2FPublishedObject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amzd%2FPublishedObject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amzd%2FPublishedObject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amzd%2FPublishedObject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amzd","download_url":"https://codeload.github.com/Amzd/PublishedObject/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amzd%2FPublishedObject/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260797705,"owners_count":23064845,"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":["combine","combine-framework","property-wrapper","swift-package-manager","swiftui"],"created_at":"2024-11-15T23:33:29.888Z","updated_at":"2025-06-19T17:40:20.418Z","avatar_url":"https://github.com/Amzd.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PublishedObject\n\nA property wrapper that forwards the objectWillChange of the wrapped ObservableObject to the enclosing ObservableObject's objectWillChange.\n\n\nJust like @Published this sends willSet events to the enclosing ObservableObject's ObjectWillChangePublisher but unlike @Published it also sends the wrapped value's published changes on to the enclosing ObservableObject.\n\n```swift\nclass Outer: ObservableObject {\n    @PublishedObject var innerPublishedObject: Inner\n    @Published var innerPublished: Inner\n\n    init(_ value: Int) {\n        self.innerPublishedObject = Inner(value)\n        self.innerPublished = Inner(value)\n    }\n}\n\nclass Inner: ObservableObject {\n    @Published var value: Int\n\n    init(_ int: Int) {\n        self.value = int\n    }\n}\n\nfunc example() {\n    let outer = Outer(1)\n    \n    // Setting property on Outer (This will send an update with either @Published or @PublishedObject)\n    outer.innerPublishedObject = Inner(2) // outer.objectWillChange will be called \n    outer.innerPublished = Inner(2)       // outer.objectWillChange will be called\n\n    // Setting property on Inner (This will only send an update when using @PublishedObject)\n    outer.innerPublishedObject.value = 3  // outer.objectWillChange will be called !!!\n    outer.innerPublished.value = 3        // outer.objectWillChange will NOT be called \n}\n```\n\nIt's only one file so you could just copy it. Also has Swift Package Manager support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famzd%2Fpublishedobject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famzd%2Fpublishedobject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famzd%2Fpublishedobject/lists"}