OCGoogleDirectionsAPI icon indicating copy to clipboard operation
OCGoogleDirectionsAPI copied to clipboard

Swift?

Open peduarte opened this issue 10 years ago • 5 comments

Please don't hate me... but, what are the chances of getting this in Swift?

This library looks great and seems to be exactly what I am after, only problem is that I don't know Objective-C and just getting into Swift. Can I use this library "with Swift", if that makes sense?

Thanks

peduarte avatar Sep 29 '15 12:09 peduarte

@peduarte good point. I will put some comments later this week how to use it in Swift projects.

marciniwanicki avatar Sep 30 '15 15:09 marciniwanicki

@marciniwanicki thanks a lot man!

peduarte avatar Sep 30 '15 16:09 peduarte

any update in swift implementation?

adrianrodriguez88 avatar May 22 '16 00:05 adrianrodriguez88

@marciniwanicki is there any chance this is going to happen soon?

ghost avatar Apr 30 '17 16:04 ghost

Sorry guys, I could not find time to maintain the project. As far as I know you can use the library as it is in Swift 3 projects (with use_frameworks! in your Podfile). Yeah, the public API won't be very nice and "swifty" but at least you can get some data.

You need to first import framework import OCGoogleDirectionsAPI

and then

    let client = OCDirectionsAPIClient(key: "<api key>")
    let request = OCDirectionsRequest(originString: "Reading", andDestinationString: "London")
    
    _ = client?.directions(request, response: { (response, error) in
   // your implementation
    })

I will think about rewriting it completely in Swift but cannot promise anything now. I've checked quickly and there are already some pure swift implementations (https://cocoapods.org/?q=lang%3Aswift%20GOOGLE%20DIRECTIONS%20), maybe it you can try one of them.

marciniwanicki avatar Apr 30 '17 19:04 marciniwanicki