DMMSecretary 0.2.0

DMMSecretary 0.2.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2015年5月

Daniel Miedema 维护。



[ 这里有一些酷图 ]

DMMSecretary 是一个库,可根据您的需要保存或转发 NSNotification

我为什么想要这样呢?

假设有一个您感兴趣的通知,但由于某些原因,您无法对其进行响应。

DMMSecretaryNotification *notification = [DMMSecretaryNotification secretaryNotificaionWithObserver:self selector:@selector(someMethod:) name:@"NotificationNameIWant" object:nil];
[[DMMSecretary sharedSecretary] createInbox:@"UniqueInboxIdentifier" notifications:@[notification]];

这将为您创建一个收件箱,并设置接收通知。与使用 [NSNotificationCenter defaultCenter] 进行注册没有区别

[[DMMSecretary sharedSecretary] startHoldingMessagesForInbox:@"UniqueInboxIdentifier"];

也许我们只关心通知的单份副本,而不是像 UIKeyboardDidShowNotification 这样的可能大量涌入的通知。只需运行

[[DMMSecretary sharedSecretary] onlyKeepUniqueMessages:YES forInboxIdentifier:@"UniqueInboxIdentifier"];

现在,如果 'NotificationNameIWant' 发生,我们不会收到它,秘书正在为我们保存通知。

当我们确实想要将通知转发给我们时,只需调用

[[DMMSecretary sharedSecretary] sendHeldNotificationsForInbox:@"UniqueInboxIdentifier"];

要请求秘书停止保存我们的通知,我们可以调用

[[DMMSecretary sharedSecretary] stopHoldingMessagesForInbox:@"UniqueInboxIdentifier"];

生成代码覆盖率报告

由于我还没想明白如何自动化生成代码覆盖率以拥有一个酷炫的徽标,因此目前它是一个手动过程。 Slathercoveralls 目前用于自动化覆盖率报告。

本地代码覆盖率报告当前使用 http://frankencover.it,该网站上有更多或更少的说明,解释了我是如何设置这一切的。

要生成代码覆盖率报告,只需运行

$ scripts/generateCodeCoverage.sh DMMSecretary

在项目的根目录中。

许可

The MIT License (MIT)

Copyright (c) 2015 Daniel Miedema

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.