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
Add automatic type conversion #68
Conversation
Automatic type conversion
Cleanup & unification
This looks great! I just have a few thoughts...
Given that it should just do the right thing if the code indexes down to a built-in type,
I'm fine merging in as-is, but I wanted to see if you had any thoughts related to my questions above. |
I added basic support for As for the If it comes to And you're right with the concerns of people being mislead about using I think that including possible explanation of "Ambiguous reference to member 'subscript'" error in |
+1 on We're in agreement regarding adding an explanation or something about the "ambiguous reference" error - I've been thinking about adding some type of FAQ.md or DebuggingTips.md or something like that, so it might be a good candidate for something like that. Don't worry about that for now. This looks good to me! If you're ready, I'll go ahead and merge and start getting this packaged up for a new release for CocoaPods and Carthage. |
@drmohundro I'm happy with how it looks now. Can be merged 💥. Glad to hear that you like it 😉. I'd rather vote for adding |
Add automatic type conversion
Not sure if this is the right place to comment, but this functionality is fantastic. I have some pretty complicated classes that I'm filling in from XML, and this looks like it will help with that quite a bit. I'm new-ish to Swift, and this beats the pants off of the complicated failable initializers and mountains of guard statements I started prototyping a while back. You mentioned above adding a Boolean deserializer, and I'd like to throw my hat in the ring for wanting that feature. I have some XML now that uses "1" and "0" for true and false, but as you mentioned, I've also seen "true" and "false", or "yes" and "no" (occasionally even "on" or "off", and "enable" or "disable", but that was very non-standard). I can't imagine too many people complaining about adding deserializers for "1"/"true" and "0"/"false". That seems like it would cover the vast majority of common cases. |
@gca3020 thanks for the feedback! I'm up for it - I'll see if I can get around to it in the next day or two. |
@gca3020 thank you, I hope you'll find it helpful. @drmohundro I can also look into it in next few days, so let me know if I can help. I guess, we should open new Issue with this request, but leave it for you. |
@drmohundro @ncreated Actually, looking at it, I'd love to use this opportunity to get a little more familiar with the GitHub Pull Request process, and contribute this functionality myself. I'll go ahead and open an issue and see if I can't get the code and everything done this weekend. |
This PR adds automatic type conversion, like this:
Inspired by discussion in #10