必需的框架与静态库 [英] Required Framework vs Static Library

查看:98
本文介绍了必需的框架与静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建现代框架每个应用程序都有自己的自定义框架副本。既然Xcode支持iOS框架,那么框架静态库是否仍然是正确的< a href =https://stackoverflow.com/a/6389802/242933>更方便?如果这是真的,那么为什么选择静态库模板呢?否则,一旦 Swift支持静态库,我应该将所有必需的自定义框架转换为静态库吗? / p>

Building Modern Frameworks says every app has its own copy of a custom framework. Now that Xcode supports iOS frameworks, is it still true that frameworks are static libraries but just more convenient? If that's true, then why choose the static library template? Otherwise, should I convert all my required custom frameworks to static libraries once Swift supports static libraries?

推荐答案


框架与静态和动态共享
库的用途相同,即它们提供了一个例程库,可以由应用程序调用
来执行特定任务。例如,
Application Kit和Foundation框架为Cocoa类和方法提供了程序化的
接口。与静态链接库和其他类型的
动态共享库相比,Frameworks提供
以下优势:

Frameworks serve the same purpose as static and dynamic shared libraries, that is, they provide a library of routines that can be called by an application to perform a specific task. For example, the Application Kit and Foundation frameworks provide the programmatic interfaces for the Cocoa classes and methods. Frameworks offer the following advantages over static-linked libraries and other types of dynamic shared libraries:


  1. 框架组相关,但分开,资源在一起。这种分组使安装,卸载和定位这些
    资源变得更加容易。

  1. Frameworks group related, but separate, resources together. This grouping makes it easier to install, uninstall, and locate those resources.

框架可以包含比库更多种资源类型。例如,框架可以包含任何相关的头文件
文件和文档。

Frameworks can include a wider variety of resource types than libraries. For example, a framework can include any relevant header files and documentation.

框架的多个版本可以包含在同一个包中。这使得向后兼容旧的
程序成为可能。

Multiple versions of a framework can be included in the same bundle. This makes it possible to be backward compatible with older programs.

只有一个框架的只读资源副本驻留在内存中任何给定的时间,无论有多少
进程正在使用这些资源。这种资源共享减少了系统内存占用的b $ b,有助于提高性能。

Only one copy of a framework’s read-only resources reside physically in-memory at any given time, regardless of how many processes are using those resources. This sharing of resources reduces the memory footprint of the system and helps improve performance.


摘录自这里

这篇关于必需的框架与静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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