{"id":15460179,"url":"https://github.com/icanzilb/cancellor","last_synced_at":"2025-04-22T10:38:41.839Z","repository":{"id":63912037,"uuid":"336007759","full_name":"icanzilb/Cancellor","owner":"icanzilb","description":"Bind multiple cancellables to the lifetime of another object like a view controller.","archived":false,"fork":false,"pushed_at":"2021-02-04T19:33:58.000Z","size":9,"stargazers_count":32,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-10-18T19:54:03.099Z","etag":null,"topics":["combine-framework","reactive-programming","swift"],"latest_commit_sha":null,"homepage":"http://trycombine.com","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/icanzilb.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}},"created_at":"2021-02-04T16:06:11.000Z","updated_at":"2022-06-27T21:04:10.000Z","dependencies_parsed_at":"2023-01-14T13:16:04.094Z","dependency_job_id":null,"html_url":"https://github.com/icanzilb/Cancellor","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icanzilb%2FCancellor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icanzilb%2FCancellor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icanzilb%2FCancellor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icanzilb%2FCancellor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icanzilb","download_url":"https://codeload.github.com/icanzilb/Cancellor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249259146,"owners_count":21239422,"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-framework","reactive-programming","swift"],"created_at":"2024-10-01T23:20:48.724Z","updated_at":"2025-04-16T16:31:41.299Z","avatar_url":"https://github.com/icanzilb.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cancellor\n\nBind multiple cancellables to the lifetime of another object like your view controller.\n\n## Usage\n\nImport **Cancellor** and subscribe your publishers inside an `ownedCancellables` block. When your view controller is dismissed any active subscriptions will get cancelled automatically. \n\n```swift\nimport Cancellor\n\nclass MyViewController: UIViewController {\n  override func viewDidLoad() {\n    ownedCancellables {\n      myPublisher1.sink(...)\n      myPublisher2.sink(...)\n      myPublisher3.assign(to: ..., on: ...)\n    }\n  }\n}\n```\n\nTo tie a single subscription to the lifetime of another object use:\n\n```swift\nclass ViewModel: NSObject { ... }\nlet vm = ViewModel(...)\n\n...\n\nmyPublisher\n  .sink(...)\n  .owned(by: vm)\n```\n\n## Import\n\nAdd the following dependency to your **Package.swift** file:\n\n```swift\n.package(url: \"https://github.com/icanzilb/Cancellor\", from: \"0.2.0\")\n```\n\n## License\n\nCancellor is available under the MIT license. See the LICENSE file for more info.\n\n## Credits\n\nCreated by Marin Todorov. \n\n📚 You can support me by checking out our Combine book: [combinebook.com](http://combinebook.com).\n\nInspired by Ash Furrow's [NSObject-rx](https://github.com/RxSwiftCommunity/NSObject-Rx).\n\nName by https://github.com/manmal.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficanzilb%2Fcancellor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficanzilb%2Fcancellor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficanzilb%2Fcancellor/lists"}