Implicitly import specific Swift module

前端 未结 2 1751
囚心锁ツ
囚心锁ツ 2020-12-09 20:04

I use a third party Swift framework in my Swift app very often and would like to use it without having to write import ModuleName in every single Swift file ove

2条回答
  •  轮回少年
    2020-12-09 20:49

    Actually there's a very easy workaround I could have thought about earlier…

    Simply add the following to your app project's Objective-C bridging header:

    @import ModuleName;
    

    Swift will pick it up too! No need for import ModuleName in every Swift file where you intend to use the module.

提交回复
热议问题