Explicity refer to global variable?

If you read the error carefully you see you're actually trying to refer to a type not module named MyModule. This happens because types currently take precedence in name lookup over modules, and you apparently reuse the same name for both in this case.

It's a known shortcoming in Swift today. AFAICT your only options are to rename the type or module (a common pattern for the latter being MyModuleKit), or to rename the variable so that it needs no qualification.

3 Likes