简体   繁体   English

将代码从Objective C转换为Swift for FactualSDK

[英]Convert code from Objective C to Swift for FactualSDK

This is my first question on Stack Overflow, I was integrating the Factual SDK in my app using swift. 这是我关于Stack Overflow的第一个问题,我正在使用swift将Factual SDK集成到我的应用程序中。 I successfully created a bridgeheader for the framework but could not figure out how to convert this line of code in order to set the authKey and ID in swift. 我为该框架成功创建了桥头程序,但无法弄清楚如何转换此代码行以快速设置authKey和ID。 Thanks in advance!! 提前致谢!!

FactualAPI* _apiObject = [[FactualAPI alloc] initWithAPIKey:@"yourkey" secret:@"yoursecret"];

Try this: 尝试这个:

let _apiObject = FactualAPI(APIKey:"yourkey" secret:"yoursecret")

I tested it and its working fine. 我测试了它,并且工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM