New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift 3/Xcode 8 conversion #111
Conversation
Project using Cocoapod builds cleanly and is able to access Uber app with the specified destination (functionality used in project app) |
Thanks for the PR! I'll go ahead and take a look at this, but before I can merge anything, could you sign the Uber CLA? |
I got your branch and it worked for a simple app of mine. Just to open UBER with 2 locations etc. Nice work!!! |
@long Thanks! This saved me a lot of headache trying to convert it myself. Now it builds successfully and runs correctly. I had some trouble figuring out how to use @long 's version of the code in my XCode project. Here's what I did:
|
@nbgraham Or you can do Inside your podfile and you will avoid 6 steps! 💃 |
@kwstasna Thanks, that's a lot better. I got a lot of build errors the first time, until I used XCode 8 migration tool Edit -> Convert -> To Current Swift Syntax… Then it said no update necessary, and I rebuilt to get it working. Why doesn't it work straight away? |
@nbgraham I really don't know. I can't reproduce because as soon as I installed the pod as I told you above, I got no errors from Uber Rides! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of my comments are just nits, but the big issue is that the tests don't compile.
Seems like a lot of the Enum renaming didn't get reflected in the test cases
fileprivate var waitingOnSystemPromptResponse = false | ||
fileprivate var checkingSystemPromptResponse = false | ||
fileprivate var promptTimer: Timer? | ||
fileprivate var completionWrapper: ((NSError?) -> ()) = { _ in } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all of these can stay as private
} | ||
|
||
completionWrapper(error) | ||
} | ||
|
||
//Mark: App Lifecycle Notifications | ||
|
||
@objc private func appWillResignActiveHandler(notification: NSNotification) { | ||
@objc fileprivate func appWillResignActiveHandler(_ notification: Notification) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the functions below can be regular private as well
fileprivate static var defaultAccessTokenIdentifier: String? | ||
fileprivate static var region : Region = .default | ||
fileprivate static var isSandbox : Bool = false | ||
fileprivate static var useFallback: Bool = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all of these fileprivate
can be private
@@ -417,15 +417,15 @@ import WebKit | |||
|
|||
// MARK: Private | |||
|
|||
private static func getPlistDictionary() -> [String : AnyObject]? { | |||
guard let path = bundle.pathForResource(plistName, ofType: "plist"), | |||
fileprivate static func getPlistDictionary() -> [String : AnyObject]? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and those below can be private
var loginQuery = baseLoginQuery(clientID, redirect: redirect, scopes: scopes) | ||
let additionalQueryItems = queryBuilder(("response_type", "token")) | ||
|
||
loginQuery.appendContentsOf(additionalQueryItems) | ||
loginQuery.append(contentsOf: additionalQueryItems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above you changed this to += additionalQueryItems
, can we do that here too?
private func getImage(name: String) -> UIImage { | ||
let bundle = NSBundle(forClass: RideRequestButton.self) | ||
let image = UIImage(named: name, inBundle: bundle, compatibleWithTraitCollection: nil) | ||
fileprivate func getImage(_ name: String) -> UIImage { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be private
@@ -481,7 +481,7 @@ struct ButtonMetadata { | |||
var dropoffLatitude: Double? | |||
var dropoffLongitude: Double? | |||
var timeEstimate: TimeEstimate? | |||
private var priceEstimateList: [PriceEstimate]? | |||
fileprivate var priceEstimateList: [PriceEstimate]? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
priceEstimateList
} | ||
} | ||
|
||
// MARK: Private | ||
|
||
private func initialSetup() { | ||
fileprivate func initialSetup() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be private
|
||
setupWebView() | ||
} | ||
|
||
private func setupWebView() { | ||
fileprivate func setupWebView() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be private
fileprivate var accessTokenWasUnauthorizedOnPreviousAttempt = false | ||
fileprivate var accessTokenIdentifier: String | ||
fileprivate var keychainAccessGroup: String | ||
fileprivate var loginCompletion: ((_ accessToken: AccessToken?, _ error: NSError?) -> Void)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loginCompletion
can be private
Sorry, I hadn't logged into github directly for a bit and hadn't received email notifications. I've just signed the Uber CLA |
Hey @long, have you had a chance to look at my comments on your PR? Would love to get this merged! |
@jbrophy17 when are you planning to release the Swift 3 SDK, with the release of Xcode 8.3, I cannot build the SDK with Swift 2.3. |
Really sad to see inactive development for this SDK. Swift 4 is released and the SDK is still not updated for Swift 3. |
Hi Vinay,
Thank you for your patience. We are indeed picking back up on this in a few
weeks. We'll be posting a plan for Swift 3/4 so everyone can keep informed.
Thanks.
…On Wed, Jun 14, 2017, 12:57 AM Vinay Jain ***@***.***> wrote:
Really sad to see inactive development for this SDK. Swift 4 is released
and the SDK is still not updated for Swift 3.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#111 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFExoGxjRiBUKCfO7WJ9nmfjahiVygydks5sD5JogaJpZM4KBVD5>
.
|
Ran the conversion to Swift 3.0 against a current project using the UberRides Cocoapod. Starting point was the swift-3-dev branch.
Updated ObjectMapper spec to ~> 2.0 to have the Swift 3 version of the dependency.
Objects with type Mappable were updated to to require the named parameter and not '_' in order to match specifications in the current version of ObjectMapper
After porting the source code, the project in this repo and test files were converted in Xcode to Swift 3.0 but not built/tested