美文网首页
创建与发布 iOS frameworks

创建与发布 iOS frameworks

作者: Mr_Cieong | 来源:发表于2016-06-09 08:16 被阅读0次

    原文:https://www.raywenderlich.com/126365/ios-frameworks-tutorial

    frameworks 的三个主要作用

    • 代码封闭
    • 代码模块化
    • 代码复用

    开始

    下载 starter project

    创建 Framework

    1. Xcode -> new -> Project -> iOS Framework & Library-> Cocoa Touch Framework.
    2. 填写相应的 Product Name, Organization Name等。
    3. 拖入相关的Code及资源文件。


    4. 添加到工程项目中(可选)
    5. 添加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.


    相关文章

      网友评论

          本文标题:创建与发布 iOS frameworks

          本文链接:https://www.haomeiwen.com/subject/qmnjdttx.html