{"id":17091194,"url":"https://github.com/youngsoft/ysobserver","last_synced_at":"2025-04-12T22:31:45.295Z","repository":{"id":56929751,"uuid":"180950024","full_name":"youngsoft/YSObserver","owner":"youngsoft","description":"一个轻量级的基于block回调通知的对象KVO扩展","archived":false,"fork":false,"pushed_at":"2019-05-29T03:55:12.000Z","size":36,"stargazers_count":37,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-22T04:32:56.093Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/youngsoft.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":"2019-04-12T07:02:52.000Z","updated_at":"2024-03-19T21:01:30.000Z","dependencies_parsed_at":"2022-08-21T04:20:59.767Z","dependency_job_id":null,"html_url":"https://github.com/youngsoft/YSObserver","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/youngsoft%2FYSObserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngsoft%2FYSObserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngsoft%2FYSObserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/youngsoft%2FYSObserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/youngsoft","download_url":"https://codeload.github.com/youngsoft/YSObserver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248640608,"owners_count":21138058,"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-10-14T13:57:59.992Z","updated_at":"2025-04-12T22:31:45.275Z","avatar_url":"https://github.com/youngsoft.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YSObserver\n\n[![CI Status](https://img.shields.io/travis/youngsoft/YSObserver.svg?style=flat)](https://travis-ci.org/youngsoft/YSObserver)\n[![Version](https://img.shields.io/cocoapods/v/YSObserver.svg?style=flat)](https://cocoapods.org/pods/YSObserver)\n[![License](https://img.shields.io/cocoapods/l/YSObserver.svg?style=flat)](https://cocoapods.org/pods/YSObserver)\n[![Platform](https://img.shields.io/cocoapods/p/YSObserver.svg?style=flat)](https://cocoapods.org/pods/YSObserver)\n\n一个轻量级的通过Block执行通知回调的对象KVO扩展，整个库一共200行代码。\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## How to use\n\n\n* Normally KVO:\n\n```\n\n@interface Observer:NSObject\n\n@end\n\n@implementation Observer\n\n-(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary\u003cNSKeyValueChangeKey,id\u003e *)change context:(void *)context\n{\n\tif ([keyPath isEqualToString:@\"frame\"]){\n\t\tNSLog(@\"the frame=%@\", change[NSKeyValueChangeNewKey]);\n    }\n}\n\n@end\n\n\nUIView *view = [UIView new];\nObserver *observer = [Observer new];\n\n[view addObserver:observer forKeyPath:@\"frame\"  options:NSKeyValueObservingOptionNew  context:NULL];\nview.frame = CGRectZero;\n\n```\n\n* YSObserver \n\n```\n\nUIView *view = [UIView new];\n[view ys_addObserver:anyObject forKeyPath:@\"frame\" withBlock:^(id newVal, id OldVal){\n\n\tNSLog(@\"the frame=%@\", newVal);\n}];\n\n```\n\n\n\n## Requirements\n\n## Installation\n\nYSObserver is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'YSObserver'\n```\n\n## Author\n\nyoungsoft, obq0387_cn@sina.com\n\n## License\n\nYSObserver is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungsoft%2Fysobserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyoungsoft%2Fysobserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyoungsoft%2Fysobserver/lists"}