-
Notifications
You must be signed in to change notification settings - Fork 43
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
[WIP] Kotlin support #77
Conversation
🚫 CI failed with log |
Generated by 🚫 Danger |
🚫 CI failed with log |
@levi sounds great. I imagined we would generate data classes and as far as builders this approach seemed interesting http://kotlinlang.org/docs/reference/type-safe-builders.html |
Would this support conversion between Map / JSON <-> Model out of the box like Codable on the Swift side? |
@maicki as far as I undertand, Kotlin doesn't currently have a codable-like feature. I was planning on taking the coder agnostic approach that we already do with the Obj-c implementation. |
@levi let me know how i can help move this one along as there are more unknowns than the Swift implementation. I can bring in some Kotlin folks at Pinterest to review the proposed generated code / patterns |
let outputs: [String] = [] | ||
return render(lines: [ | ||
renderCommentHeader(), | ||
"import Foundation", |
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.
Foundation? In Kotlin?
Levi let me know if you want to strategize Kotlin implementation. Would be happy to help, as I have an interest in having Kotlin supported as well :) |
Would be good to know what is are the missing pieces to get it over the finish line cc @levi. If we could get Kotlin support into Plank, so we test it within Pinterest that would be huge. |
@christinalee would appreciate some insight on a builder pattern API you'd find useful. The rest of the work is pretty straight forward to implement. |
@levi @christinalee - Thoughts on this approach: https://proandroiddev.com/dsl-builder-in-kotlin-be5816ba3ca7 |
@rahul-malik given the presence of named constructor variables, default copy implementations in |
Should we start an issue like the one we did with flow: #56 were we maybe figure out together the right API / patterns we will use? |
Would be happy to @maicki. Rahul Bkase and I also spent a few hours discussing this. We went down several different paths but ended up looping back to the traditional static-esque builder pattern, that has a data class with a companion object that handles the building like this example:
We discussed numerous other options (including the one linked above), but when considering method counts, performance, and java interoperability, this seemed to give us the most utility with the fewest sacrifices. Because the object is a data class, Kotlin callers can use the built in Anywho, happy to hear feedback and continue iterating on this idea, but based on our explorations, wanted to throw this out as a starting suggestion |
Very much WIP. Currently builds off the other Swift PR.
Still determining a design strategy for the models, likely will use a hybrid of data classes and the builder pattern. Open to suggestions.