如何使用@testable导入带空格的模块

How to Import module with spaces using @testable

听起来像一个愚蠢的问题,但我想知道我应该如何导入带有 spaces 的模块?

我正在按照 this link 添加测试用例,但我的项目有一个 space,比如说 foo bar。那么我应该如何使用 @testable

导入

@testable import foo bar 抛出错误

我也有这个问题,最后发现下划线 _ 是模块名称中空格的替代品。

所以你应该这样写。

@testable import foo_bar