{"id":18269718,"url":"https://github.com/skyfe79/kvobservable","last_synced_at":"2026-04-30T10:05:59.787Z","repository":{"id":229457815,"uuid":"776777626","full_name":"skyfe79/KVObservable","owner":"skyfe79","description":"A Swift package simplifying KVO and NotificationCenter property and notification observing.","archived":false,"fork":false,"pushed_at":"2024-03-25T09:01:28.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T03:15:27.506Z","etag":null,"topics":["ios","macos","swift"],"latest_commit_sha":null,"homepage":"https://github.com/skyfe79/KVObservable","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/skyfe79.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}},"created_at":"2024-03-24T13:17:30.000Z","updated_at":"2024-03-27T10:37:19.000Z","dependencies_parsed_at":"2024-11-05T11:41:33.708Z","dependency_job_id":"7d3d97a0-ac65-4aa9-8a78-5517942c7ba5","html_url":"https://github.com/skyfe79/KVObservable","commit_stats":null,"previous_names":["skyfe79/kvobservable"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/skyfe79/KVObservable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyfe79%2FKVObservable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyfe79%2FKVObservable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyfe79%2FKVObservable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyfe79%2FKVObservable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyfe79","download_url":"https://codeload.github.com/skyfe79/KVObservable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyfe79%2FKVObservable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32460823,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"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":["ios","macos","swift"],"created_at":"2024-11-05T11:36:58.237Z","updated_at":"2026-04-30T10:05:59.758Z","avatar_url":"https://github.com/skyfe79.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KVObservable\n\nKVObservable is a Swift package that provides observable and publisher classes leveraging Key-Value Observing (KVO) and NotificationCenter for monitoring changes to properties on `NSObject` subclasses and system-wide notifications. It simplifies observing property changes and notifications by managing the observation lifecycle automatically.\n\n## Features\n\n- **KVObservable**: An observable class for monitoring changes to a specific property.\n- **KVOPublisher**: A publisher class that emits changes of a specific property through Combine's `PassthroughSubject`.\n- **NotificationObservable**: A class for observing notifications for a specific `NSNotification.Name`.\n- **NotificationPublisher**: A publisher class that observes notifications and publishes those through a Combine `PassthroughSubject`.\n\n## Requirements\n\n- iOS 13.0+ / macOS 10.15+ / watchOS 8.0+ / tvOS 13.0+ / macCatalyst 13.0+ / visionOS 1.0+\n\n## Installation\n\nAdd the package to your project by adding the following to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/skyfe79/KVObservable.git\", .upToNextMajor(from: \"0.0.3\"))\n]\n```\n\n## Usage\n\n### KVObservable\n\nMonitor changes to a property:\n\n```swift\nlet observable = KVObservable(object: yourNSObject, keyPath: \\.yourProperty) { newValue in\n    print(\"New value: \\(newValue)\")\n}\n```\n\nPause and resume observation:\n\n```swift\nobservable.pause()\nobservable.resume()\n```\n\n### KVOPublisher\n\nUse `KVOPublisher` to integrate with Combine:\n\n```swift\nlet publisher = KVOPublisher(object: yourNSObject, keyPath: \\.yourProperty)\npublisher.value.sink { newValue in\n    print(\"New value: \\(newValue)\")\n}.store(in: \u0026cancellables)\n```\n\nPause and resume observation:\n\n```swift\npublisher.pause()\npublisher.resume()\n```\n\n### NotificationObservable\n\nObserve notifications for a specific `NSNotification.Name`:\n\n```swift\nlet notificationObservable = NotificationObservable(name: .yourNotificationName, object: nil, queue: .main) { notification in\n    print(\"Notification received: \\(notification)\")\n}\n\n// To pause and resume observation\nnotificationObservable.pause()\nnotificationObservable.resume()\n```\n\n### NotificationPublisher\n\nUse `NotificationPublisher` to observe notifications and publish those through Combine:\n\n```swift\nlet notificationPublisher = NotificationPublisher(notificationName: .yourNotificationName, object: nil, queue: .main)\n\nnotificationPublisher.notification.sink { notification in\n    print(\"Notification received: \\(notification)\")\n}.store(in: \u0026cancellables)\n\n// To pause and resume observation\nnotificationPublisher.pause()\nnotificationPublisher.resume()\n```\n\n## License\n\nKVObservable is released under the MIT license. See LICENSE for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyfe79%2Fkvobservable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyfe79%2Fkvobservable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyfe79%2Fkvobservable/lists"}