# NayObserver **Repository Path**: nay118/nay-observer ## Basic Information - **Project Name**: NayObserver - **Description**: No description available - **Primary Language**: Swift - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-12-18 - **Last Updated**: 2025-12-16 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # NayObserver [![CI Status](https://img.shields.io/travis/HuangMeining/NayObserver.svg?style=flat)](https://travis-ci.org/HuangMeining/NayObserver) [![Version](https://img.shields.io/cocoapods/v/NayObserver.svg?style=flat)](https://cocoapods.org/pods/NayObserver) [![License](https://img.shields.io/cocoapods/l/NayObserver.svg?style=flat)](https://cocoapods.org/pods/NayObserver) [![Platform](https://img.shields.io/cocoapods/p/NayObserver.svg?style=flat)](https://cocoapods.org/pods/NayObserver) ## Example To run the example project, clone the repo, and run `pod install` from the Example directory first. ## Requirements ## Installation NayObserver is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile: ```ruby pod 'NayObserver' ``` ## Author HuangMeining, 97259412@qq.com ## License NayObserver is available under the MIT license. See the LICENSE file for more info. ``` 使用例子: @NayOb var value: CGFloat = 0 // 在你要监听的属性前面加 @NayOb // 要监听的地方添加以下代码, 就是这么简单 $value.add(self) { x in printDebug(x) } 其它写法: //写法2 nayOb($value) { x in printDebug(x) } //系统或第三方可kvo的属性 nayOb(object, "value").addNext { x in printDebug(x) } //通知 nayOb(NSNotification.Name) { x in printDebug(x) } // 2个属性合并 nayObTwo($value1, $value2).add { x1, x2 in printDebug(x1) printDebug(x2) } // 2-5个属性合并 nayObFive($value1, $value2, $value3).add { x in printDebug(x.a!) printDebug(x.b!) printDebug(x.c!) } ```