CSVImporter icon indicating copy to clipboard operation
CSVImporter copied to clipboard

Compact Mapping and Error Handling

Open AdamPro13 opened this issue 3 years ago • 1 comments

Proposed Changes

  • Adds compactMapping functions to help when deserializing CSV to model objects. This allows an application to return a nil value when mapping from [String] to T if their application has deemed the data invalid.
  • Adopts a more Swift-like error handling approach when mapping values. This is based on how map(_:) and compactMap(_:) are built in the Swift Standard Library. These changes will allow errors to be thrown in the mapping closures, but shouldn't require existing users of this framework to update how they're currently using this framework.
  • Removed a dependency that did not appear to be used.

I'm having trouble getting the tests to run on my machine so I'm currently unable to test this or write new tests. I tried setting up Carthage by running carthage update but the build always fails on HandySwift tvOS or HandySwift iOS.

Do you have any suggestions on how to get that fixed up? I wouldn't want this to get merged until I've been able to validate this.

AdamPro13 avatar Oct 30 '20 02:10 AdamPro13

@AdamPro13 Thank you for this pull request, I just saw this in my inbox, sorry for the late reply. I will have a look at this soon, but please note that your changes are breaking changes to me on first glance and you might need to either overload existing functions so the changes are not breaking or at least provide hints in the Xcode fix-it style.

Jeehut avatar Nov 15 '20 14:11 Jeehut