Monday, January 7, 2019

Swift Import Declarations

Mattt Thompson:

Import declarations have a form that can specify individual structures, classes, enumerations, protocols, and type aliases as well as functions, constants, and variables declared at the top-level:

import <#kind#> <#module.symbol#>

Here, kind can be any of the following keywords[…]

[…]

In practice, isolating imported declarations and submodules doesn’t confer any real benefit beyond signaling programmer intent. Your code won’t compile any faster doing it this way. And since most submodules seem to re-import their umbrella header, this approach won’t do anything to reduce noise in autocomplete lists.

If you gave up after finding that import Module.Class doesn’t work, you actually can do it with import class Module.Class.

Comments RSS · Twitter

Leave a Comment