仅从模块导入特定扩展
Importing only specific extensions from a module
假设我在模块 A
中有一些扩展:
public extension String {
func foo() { ... }
}
在模块 B
中,有时我想导入单独的扩展(或文件),就像我可以 import struct
、import enum
、...
两者都不是
import struct A.String
import func A.String.foo
有效,而且似乎没有针对扩展的关键字。
这可能吗?怎么样?
首先阅读这个:apple doc modules
但这是不可能的,您只能使用访问级别
假设我在模块 A
中有一些扩展:
public extension String {
func foo() { ... }
}
在模块 B
中,有时我想导入单独的扩展(或文件),就像我可以 import struct
、import enum
、...
两者都不是
import struct A.String
import func A.String.foo
有效,而且似乎没有针对扩展的关键字。
这可能吗?怎么样?
首先阅读这个:apple doc modules 但这是不可能的,您只能使用访问级别