以安全的方式共享代码 Objective-C

发布于 2024-09-29 23:23:02 字数 498 浏览 0 评论 0原文

只是我很好奇。 我为 Objective-C 类(NSObject、NSDictionary、NSString...)创建了很多方便的类别,只要是非常有趣的子类,就可以让 iPhone/iPad 编程中的很多流行任务变得简单仅放置一行代码或触发一个方法。

我想与其他人分享这段代码,但问题是,我不希望他们看到真正的代码,只要我花了几个小时来创建它。也许将来我也想卖掉这段代码。

因此,我们假设该文件名为 Extensions 并分为两个文件: Extensions.h(其中大约有 100 个标头)和 Extensions.m - 它们的实现。 我想以 Extensions.h 100% 公开的方式分发此类 - 开发人员可以看到我放入该文件中的代码,这样他就知道如何使用这些扩展,但 Extensions.m 不应该作为可见的代码,但作为库或类似的东西。

我还希望在自定义项目中尽可能轻松地实现上述内容。最好的方法就是拖放并在标题中添加#import Extensions.h。

我期待听到您的建议。 问候 克里斯

Just I'm curious.
I have created a lot of convinient categories to the Objective-C classes (NSObject, NSDictionary, NSString...), as long as very interesting subclasses that makes a lot of popular task in the iPhone/iPad programming, to be as easy as putting only one line of code or firing a method.

I'd like to share this code with others but the problem is, I don't want them to see the real code as long as I spent hours on creating it. Perheps in future I'd also like to sold this piece of code.

So let's assume the file is called Extensions and is divided into two files:
Extensions.h (where are about 100 headers) and the Extensions.m - their implementations.
I'd like to distribute this class in a way that Extensions.h is 100% public - developer sees the code I've put in that file so he knows how to use those extensions, but Extensions.m should not be visible as a code, but as a library or something like that.

I also would like to make the implementation of above in the custom projects as easy as possible. The best way would be just drag'n'drop and #import Extensions.h in the header.

I'm looking forward to hearing you advices.
Regards
Chris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情仇皆在手 2024-10-06 23:23:02

Flurry 就是这样做的...他们分发一个带有标头的 .h 文件和一个带有代码的 .a 文件。所以看起来你可以编译一个 .a 文件来分发。

Flurry does this... they distribute a .h file with the headers and a .a file with the code. So looks like you could compile a .a file for distribution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文