{"id":18270378,"url":"https://github.com/hellozimi/KVOR","last_synced_at":"2025-04-05T01:30:32.573Z","repository":{"id":7090827,"uuid":"8381724","full_name":"hellozimi/KVOR","owner":"hellozimi","description":"Objective C KeyValueObservation is in the block.","archived":true,"fork":false,"pushed_at":"2013-04-06T22:26:55.000Z","size":160,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-05T11:52:47.309Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Objective-C","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/hellozimi.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}},"created_at":"2013-02-23T20:52:13.000Z","updated_at":"2023-01-28T20:50:25.000Z","dependencies_parsed_at":"2022-08-19T13:51:09.684Z","dependency_job_id":null,"html_url":"https://github.com/hellozimi/KVOR","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellozimi%2FKVOR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellozimi%2FKVOR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellozimi%2FKVOR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hellozimi%2FKVOR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hellozimi","download_url":"https://codeload.github.com/hellozimi/KVOR/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276022,"owners_count":20912285,"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":[],"created_at":"2024-11-05T11:38:33.415Z","updated_at":"2025-04-05T01:30:32.250Z","avatar_url":"https://github.com/hellozimi.png","language":"Objective-C","readme":"#KVOR\n\nKVOR is a block based wrapper around [KVO](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueObserving/KeyValueObserving.html). It's really easy to use and it supports multiple key paths per block. Check the examples below to get started.\n\n### Methods\nAdd observer\n\n```objc\n+ (void)target:(id)target keyPath:(NSString *)keyPath task:(KVORObserverTaskBlock)block;\n+ (void)target:(id)target keyPaths:(NSArray *)keyPaths task:(KVORObserverTaskBlock)block;\n```\n\nRemove observer\n\n```objc\n+ (void)removeObserverWithTarget:(id)target andKeyPath:(NSString *)keyPath;\n+ (void)removeObserverWithTarget:(id)target andKeyPaths:(NSArray *)keyPaths;\n+ (void)removeAllObservers;\n```\n---\n\n\n### Example\n\nBasic value listening\n\n```objc\n\n// Start listening\n__block typeof(self) weakSelf = self;\n[KVOR target:self.scrollView\n     keyPath:@\"contentOffset\"\n        task:^(NSString *keyPath, NSDictionary *change) {\n            if ([keyPath isEqualToString:@\"contentOffset\"]) {\n                NSLog(@\"Offset: %@\", NSStringFromCGPoint([weakSelf.scrollView contentOffset]));\n            }\n            \n        }];\n\n```\n\nYou're also able to listen on multiple keyPaths in the same block.\n\n```objc\n\n// Start listening\n__block typeof(self) weakSelf = self;\n[KVOR target:self.scrollView\n    keyPaths:@[@\"contentOffset\", @\"contentSize\"]\n        task:^(NSString *keyPath, NSDictionary *change) {\n            if ([keyPath isEqualToString:@\"contentOffset\"]) {\n                NSLog(@\"Offset: %@\", NSStringFromCGPoint([weakSelf.scrollView contentOffset]));\n            }\n            else if ([keyPath isEqualToString:@\"contentSize\"]) {\n                NSLog(@\"Size: %@\", NSStringFromCGSize([weakSelf.scrollView contentSize]));\n            }\n        }];\n\n```","funding_links":[],"categories":["etc"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellozimi%2FKVOR","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellozimi%2FKVOR","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellozimi%2FKVOR/lists"}