I am looking to reuase some (iOS) client side code into a sample Vapor serverside project.
我希望将一些(iOS)客户端代码传递到示例蒸汽服务器端项目中。
The code in question relies on SwiftyJSON functionality, defined as a struct JSON; now this name slot is not 'free', but already used inside a package that Vapor relies upon (the package name is JSON, as well).
所涉及的代码依赖于SwiftyJSON功能,定义为struct JSON;现在这个名称槽不是“free”,而是已经在蒸气依赖的包中使用(包名也是JSON)。
While I can point to the JSON thing I want in my former client side code (as App.JSON), the controller that is boilerplated into the code also uses JSON. And apparently putting as I did the SwiftyJSON library files into the App namespace actually overrides the moduleless references to Vapor's JSON.
虽然我可以在以前的客户端代码(如App.JSON)中指出我想要的JSON,但是在代码中被样本化的控制器也使用JSON。显然,像我一样将SwiftyJSON库文件放入应用程序名称空间,实际上覆盖了对蒸气的JSON的无模块引用。
I tried to refer then to JSON.JSON, but it does not get recognized. JSON is a defined and compiled framework in the project. Should it not define implicitely a module name, as well?
然后我尝试引用JSON。JSON,但它没有被识别。JSON是项目中定义和编译的框架。它不应该也定义一个模块名吗?
How can I reach Vapor's JSON, then?
那么,我如何才能达到蒸气的JSON呢?
Thanks..
谢谢. .
1 个解决方案
#1
1
As a matter of fact, the Vapor
module also exports JSON
. So, the following works:
实际上,蒸气模块也导出JSON。所以,以下工作:
import Vapor
// Introduce a symbol collision
struct JSON {}
// Import from the Vapor module
print(try Vapor.JSON(node: "test"))
#1
1
As a matter of fact, the Vapor
module also exports JSON
. So, the following works:
实际上,蒸气模块也导出JSON。所以,以下工作:
import Vapor
// Introduce a symbol collision
struct JSON {}
// Import from the Vapor module
print(try Vapor.JSON(node: "test"))