最近我开始比以前更积极地模块化我的应用程序,将代码片段分离到框架或库中.
Recently I started to modularize my applications much more aggresively than I used to, separating pieces of code into frameworks or libraries.
我喜欢桌面 Cocoa 中私有框架"的概念,即.应用程序包中包含的框架.根据我的小经验,框架比简单的库更适合代码重用,因为框架可以包含自己的头文件.这使得向现有项目中添加新框架变得更加容易.
I like the concept of "private frameworks" in desktop Cocoa, ie. the frameworks included in the application bundle. From my small experience the frameworks are better suited for code reuse than simple libraries, as the frameworks can include their own headers with them. This makes adding a new framework to an existing project a whole lot easier.
问题在于 iOS 不支持这些私有"框架.您必须在那里处理静态库,并且标头管理很痛苦.Apple 是否有充分的技术理由不支持 iOS 上的框架?
The problem is that these "private" frameworks are not supported on iOS. You have to do with static libraries there, and the header management is a pain. Is there a good technical reason for Apple to not support frameworks on iOS?
(只是为了确保:不幸的是,Apple 将私有框架"一词用于两件事.第一个是应用程序附带的自定义"框架,第二个是人们不应该使用的未记录和禁止的框架iOS.我问的是前者.)
(Just to make sure: Apple unfortunately uses the term "private framework" for two things. The first is "custom" frameworks that ship with an application, the second is undocumented and prohibited frameworks that people are not supposed to use on iOS. I’m asking about the former.)
PS.这在 iOS 8 中是否发生了变化?Xcode 6 中有一个Cocoa Touch Framework"模板.
PS. Did this change in iOS 8? There’s a "Cocoa Touch Framework" template in Xcode 6.
现在看来自定义框架是 Xcode 6 支持:
It appears that custom frameworks are now supported by Xcode 6:
iOS 开发人员现在可以创建动态框架.框架是一个用于封装功能的代码和资源集合跨多个项目有价值.框架完美配合扩展,共享逻辑,可以由两个主要使用应用程序和捆绑的扩展.
iOS developers can now create dynamic frameworks. Frameworks are a collection of code and resources to encapsulate functionality that is valuable across multiple projects. Frameworks work perfectly with extensions, sharing logic that can be used by both the main application, and the bundled extensions.
这篇关于iOS 是否支持私有框架?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!