Using Bing Translator Api in Xcode using swift

844 views Asked by At

I am using FGTranslator(https://github.com/gpolak/FGTranslator) to access bing translator api with swift but the problem is that FGTranslator is written in objective c and I am using swift but according to Apple we can do it. I successfully added these classes in my project with bridging header and I also installed AFNetworking with Pod Setup. Now I can successfully compile my program without an error.

    override func viewDidLoad() {
    super.viewDidLoad()
    let BING_CLIENT_ID = "some ID"
    let  BING_CLIENT_SECRET = "some Secret";
    let inputText = "Bonjour"
    var fr = "fr"
    var to = "en"
    var translator :FGTranslator = FGTranslator(bingAzureClientId: BING_CLIENT_ID, secret:  BING_CLIENT_SECRET)
    translator.translateText(inputText, completion:nil)

}

At the last line where translator.translateText is called completion is required which I am giving nil. Can anybody help me to get translation done. I am a newbie programmer

0

There are 0 answers