How to import a Swift framework globally?

后端 未结 6 947
情歌与酒
情歌与酒 2020-12-14 05:56

I want to have a way to import my Swift Cocoapods globally in every class, how can I achieve this?

I tried a lot of things and they didn\'t work. Here are some ways

6条回答
  •  醉话见心
    2020-12-14 06:36

    It's strongly discouraged in Swift because that would introduce implicit coupling between modules.

    However, you can make a certain symbol available globally by declaring a typealias in the module that imports the other module:

    import ModuleName
    public typealias ClassName = ModuleName.ClassName
    

提交回复
热议问题