What is import func, struct, class, and @_exported in Swift?

ε祈祈猫儿з 提交于 2019-12-03 06:53:45

You can import only a specific part of a module, not a whole module:

Providing more detail limits which symbols are imported—you can specify a specific submodule or a specific declaration within a module or submodule. When this detailed form is used, only the imported symbol (and not the module that declares it) is made available in the current scope.

From Import Declaration

For example import func POSIX.isatty will import function isatty from module POSIX instead of importing the whole module POSIX (which is BIG).

The @_exported attribute starts with an underscore. That means it's a private Swift attribute. Not a feature, an implementation detail. In short, this attribute lets you export a symbol from another module as if it were from your module.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!