Hello,
I found an issue with the new TreatTypesAsStrings
option for the Swift client. I did the following steps in XCode while testing and the code generated was not what I expected
- Update my service reference with the option
TreatTypesAsStrings: TimeSpan
- The generated code is as expected: my TimeSpan properties are now Strings
- Update my service reference without the option
TreatTypesAsStrings
- The generated code is the same as the previous update: the TimeSpan properties are still Strings
- I am forced to recycle my app to ‘fix’ this issue
I looked at the code of the SwiftGenerator and it looks like the issue is caused by this line. I can see 2 errors with that line:
- It adds the
TreatTypesAsStrings
option to the static dictionary
- I think a copy of the dictionary should be made instead of adding items to it
- It uses a ‘normal’ Dictionary instead of a ConcurrentDictionary which can causes weird issues if 2 threads tries to add/get items to it
- I doubt that this will cause an issue since the SwiftGenerator should never be called this often but it should still be fixed
This is not a showstopper but I thought I should let you know.