Skip to content
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 4 #2

Closed
ryandesign opened this issue Sep 3, 2018 · 5 comments
Closed

Swift 4 #2

ryandesign opened this issue Sep 3, 2018 · 5 comments

Comments

@ryandesign
Copy link
Contributor

Hi, could this be updated to support Swift 4?

@ronaldmannak
Copy link
Owner

I don't have the car anymore, so it's hard for me to update the code. Upgrading to Swift 4 itself is doable, but I can't know for sure if the BMW backend is still the same after two years. Feel free to fork the project and upgrade to Swift 4 if you want to.

@ryandesign
Copy link
Contributor Author

I understand, of course! It is difficult for me, because my knowledge of Swift is not very extensive and I've never seen CocoaPods or Decodable or Alamofire before. I have spent many hours working on it already.

The first thing I've realized is that I don't actually need your library updated to Swift 4 immediately, because Xcode 9 lets me specify different Swift language versions for different subprojects. So I should be able to tell it my code is Swift 4 and your library is Swift 3 and they should work together.

Which leads to the next problem, which is that your code doesn't work with Swift 3 either. It was last updated with a beta version of Xcode 8, and the Swift 3 language changed after that. I've downgraded to Xcode 8.3.3 and used its Swift 2 to 3 converter as a first step in fixing this.

Decodable and Alamofire didn't have Swift 3 compatible versions either when you last updated this library, so you depended on master of Decodable and the swift3 branch of Alamofire 3. Decodable has since released a Swift 3 compatible version, 0.5.0, and updating your code for that was easy. Unfortunately Alamofire's first official Swift 3 release was version 4, which completely changed the API; I will try to update the code for this but it will be challenging. They deleted their swift3 branch so I can't fall back on that either.

I can share my work-in-progress branch with you later, after I've made a little more progress. Maybe you'll be able to help with any remaining error messages that I don't understand.

@ronaldmannak
Copy link
Owner

Oh wow, it surprising to see how much has changed since. I haven't used either Alamofire nor Decodable in projects in ages. Using third party frameworks is always a risk in the long term, apologies that you have to go through so much hassle to get it working.

Don't forget that even if the app is working, BMW could have changed their server API since. I was in touch with the project manager of the official BMW iPhone app when I developed this, and they were migrating to a new system at the time. I don't know what the status is now. I remember they ran into some issues (the team working on it was an acquired former Nokia firmware team that neither had experience with backends nor mobile), so be prepared for a few surprises.

Happy to help if I can, lmk.

@ryandesign
Copy link
Contributor Author

Hey, I got it compiling and running. Very neat to see my car's info in the menubar. I still need to clean up my commits a bit but I'll send a PR in a day or two.

@ronaldmannak
Copy link
Owner

That's great to hear! I honestly had my doubts, with so many dependencies. Thanks for spending time on this, I appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants