创建与发布 iOS frameworks
2016-06-09 本文已影响0人
Mr_Cieong
原文:https://www.raywenderlich.com/126365/ios-frameworks-tutorial
frameworks 的三个主要作用
- 代码封闭
- 代码模块化
- 代码复用
开始
创建 Framework
- Xcode -> new -> Project -> iOS Framework & Library-> Cocoa Touch Framework.
- 填写相应的 Product Name, Organization Name等。
-
拖入相关的Code及资源文件。
- 添加到工程项目中(可选)
-
添加frameworks 到 Embedded Binaries中
Access Control(访问控制)
Swift有三种访问控制:
- Public: for code called by the app or other frameworks, e.g., a custom view.
- Internal: for code used between functions and classes within the framework, e.g., custom layers in that view.
- Private: for code used within a single file, e.g., a helper function that computer layout height.
Update the Storyboard
In the Identity Inspector, under Custom Class, change the Module to ThreeRingControl.