0

I am trying to use the Lyft API for iOS with Swift 4 and Xcode 9.3.

When I use the pod LyftSDK, the framework files do not compile per this issue, which I fixed (but it seemed bizarre that a major API would not compile in a production build). It's currently an open issue on the Lyft-iOS-SDK GitHub, #17. I'm also using the pod Lyft because I was unsure of which to use.

In my view controller, I've imported: import Lyft import LyftSDK

But then when I go to use let lyftButton = LyftButton() I get the compilation error Use of unresolved identifier 'LyftButton'.

How do I use this API with Swift? Do I need both pods for it to work? I'm following the documentation line for line and can't get it to work how it's supposed to. None of the other APIs and CocoaPods I'm using have this issue.

wcarhart
  • 2,685
  • 1
  • 23
  • 44
  • 1
    Random fact: Spotify SDK seems to not have updated to Swift 4, either. So perhaps not so bizzarre. You probably want to ask Lyft about this (maybe indeed their system is that one should ask here. Some companies do that). –  May 10 '18 at 15:06
  • 1
    @user770 Yes, perhaps that is the issue. Their GitHub asks to post on SO with the `lyft-api` tag, but I'll consider opening a new issue on GitHub too. – wcarhart May 10 '18 at 15:12
  • 1
    @user770 Opened as [Issue #18](https://github.com/lyft/Lyft-iOS-sdk/issues/18) on GitHub lyft/Lyft-iOS-SDK – wcarhart May 10 '18 at 15:25

1 Answers1

0

I solved this by doing the following:

In LyftSDK/Core/LyftButton.swift, change Line 47 from private var pressUpAction: ((Void) -> Void)? to private var pressUpAction: (() -> Void)?.

In LyftSDK/Core/LyftAPIURLEncoding.swift, replace Line 32 with:

var localVariable = urlComponents 
urlComponents?.queryItems = (localVariable?.queryItems ?? []) + queryItems
wcarhart
  • 2,685
  • 1
  • 23
  • 44