{"id":22694815,"url":"https://github.com/kosoku/agamotto","last_synced_at":"2025-04-13T01:23:40.376Z","repository":{"id":18935866,"uuid":"84411153","full_name":"Kosoku/Agamotto","owner":"Kosoku","description":"Agamotto is an iOS/macOS/tvOS/watchOS framework that provides block based extensions to KVO and NSNotificationCenter.","archived":false,"fork":false,"pushed_at":"2022-07-22T07:59:42.000Z","size":194,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-16T06:45:48.939Z","etag":null,"topics":["ios","kvo","macos","tvos","watchos"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","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/Kosoku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-09T07:21:19.000Z","updated_at":"2022-09-01T19:10:38.000Z","dependencies_parsed_at":"2022-07-25T06:47:05.028Z","dependency_job_id":null,"html_url":"https://github.com/Kosoku/Agamotto","commit_stats":null,"previous_names":[],"tags_count":28,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kosoku%2FAgamotto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kosoku%2FAgamotto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kosoku%2FAgamotto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kosoku%2FAgamotto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kosoku","download_url":"https://codeload.github.com/Kosoku/Agamotto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228996052,"owners_count":18003633,"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":["ios","kvo","macos","tvos","watchos"],"created_at":"2024-12-10T03:09:58.493Z","updated_at":"2024-12-10T03:09:59.103Z","avatar_url":"https://github.com/Kosoku.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Agamotto\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Version](http://img.shields.io/cocoapods/v/Agamotto.svg)](http://cocoapods.org/?q=Agamotto)\n[![Platform](http://img.shields.io/cocoapods/p/Agamotto.svg)]()\n[![License](http://img.shields.io/cocoapods/l/Agamotto.svg)](https://github.com/Kosoku/Agamotto/blob/master/license.txt)\n\n*Agamotto* is an iOS/macOS/tvOS/watchOS framework that provides block based extensions to KVO and `NSNotificationCenter`. It handles tearing down the observer upon deallocation. It is based on part of the [ReactiveCocoa Objective-C framework](https://github.com/ReactiveCocoa/ReactiveObjC).\n\n### Installation\n\nYou can install *Agamotto* using [cocoapods](https://cocoapods.org/), [Carthage](https://github.com/Carthage/Carthage), or as a framework.\n\n### Usage\n\nYou **must** do the `weakSelf`/`strongSelf` dance for any blocks passed to the observing methods. Otherwise a retain cycle will be introduced.\n\nIt is not required in the notification observing example because `self` is not called within the block.\n\n```objc\n#import \u003cAgamotto/Agamotto.h\u003e\n\nstatic NSNotificationName const kTextDidChangeNotification = @\"kTextDidChangeNotification\";\n\n@interface MyObject : NSObject\n@property (copy) NSString *text;\n\n- (void)foo;\n@end\n\n@implementation MyObject\n\n- (instancetype)init {\n\tif (!(self = [super init]))\n\t\treturn nil;\n\t\n\t__weak __typeof__(self) weakSelf = self;\n\t[self KAG_addObserverForKeyPath:@\"text\" options:0 block:^(NSString *keyPath, id _Nullable value, NSDictionary\u003cNSKeyValueChangeKey, id\u003e *change){\n\t\t__strong __typeof__(weakSelf) strongSelf = weakSelf;\n\t\t\n\t\t[self foo];\n\t}];\n\t\n\t[self KAG_addObserverToNotificationCenter:nil notificationName:kTextDidChangeNotification object:self block:^(NSNotification *notification){\n\t\tNSLog(@\"notification %@\",notification);\n\t}];\n\t\n\treturn self;\n}\n\n- (void)foo {\n\tNSLog(@\"text %@\",self.text);\n}\n\n- (void)setText:(NSString *)text {\n\t_text = [text copy];\n\t\n\t[[NSNotificationCenter defaultCenter] postNotificationName:kTextDidChangeNotification object:self];\n}\n\n@end\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosoku%2Fagamotto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkosoku%2Fagamotto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkosoku%2Fagamotto/lists"}