iOS上支持私有框架吗? [英] Are private frameworks supported on iOS?

查看:122
本文介绍了iOS上支持私有框架吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开始比以前更积极地模块化我的应用程序,将代码片段分离成框架或库。



我喜欢private frameworks 在桌面可可中,即。包含在应用程序包中的框架。从我的小经验来看,框架比简单的库更适合代码重用,因为框架可以包含它们自己的头文件。这使得更容易为现有项目添加新框架。



问题是这些私人框架在iOS上不受支持。你必须在那里使用静态库,而头管理是一个痛苦。是否有一个很好的技术理由让苹果不支持iOS上的框架?



(只是为了确保:苹果不幸使用私人框架这个词来表示两件事情。首先是随应用程序一起提供的定制框架,其次是没有文档和禁止的框架,人们不应该在iOS上使用框架,我问的是前者。)



PS。 iOS 8中有这种变化吗?有在Xcode 6可可触摸框架模板。


解决方案

看来,定制框架现在的通过的Xcode 6 支持:


iOS开发人员现在可以创建动态框架。框架是一个
的代码和资源集合,用于封装跨多个项目的
有价值的功能。框架与
扩展完美协同工作,共享可用于
主应用程序和捆绑扩展的逻辑。



Recently I started to modularize my applications much more aggresively than I used to, separating pieces of code into frameworks or libraries.

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.

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?

(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. Did this change in iOS 8? There’s a "Cocoa Touch Framework" template in Xcode 6.

解决方案

It appears that custom frameworks are now supported by Xcode 6:

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上支持私有框架吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆