Repository navigation
Model Setup for String Catalog - #14
Conversation
|
@Uni-boy is your PR ready for review please? |
|
Yeah my PR is ready. |
| let strings: [String: StringInfo] | ||
| } | ||
|
|
||
| struct StringInfo: Decodable { |
There was a problem hiding this comment.
Is it the best practice to put all structs in the same source file?
There was a problem hiding this comment.
Again, these structs should be consumed. Please check my previous comments: #14 (review)
|
@Uni-boy if you don't have any plan to update this PR, please feel free to close it. Thank you. |
|
I finalized the model and all tests passed. |
Please merge from More importantly, when I said "these structs should be consumed", I meant the |
I applied the model to main.swift and solved the TODO in StringEnumHelper.swift |
superarts
left a comment
There was a problem hiding this comment.
Please address the obvious issues I pointed out, but my PR review is not finished yet. I'll add another review soon.
There was a problem hiding this comment.
Delete xcode related files from git. You shouldn't use xcode for this project, but if you insist doing so (not recommended, I can see a sample xcode project being added in future, but not for the CLI tool itself), you can add this file to .gitignore.
| // let variations: Variations? | ||
| } | ||
|
|
||
| // struct Variations: Decodable { |
There was a problem hiding this comment.
These are dead codes too but I'll need to further look into it.
superarts
left a comment
There was a problem hiding this comment.
Almost there! Just a few minor suggestions.
superarts
left a comment
There was a problem hiding this comment.
Please address this: #14 (comment)
And added some other suggestions regarding unit tests. Sorry I forgot them in my previous review.
| let decoder = JSONDecoder() | ||
| expect{ | ||
| try decoder.decode(Localizations.self, from: jsonData) | ||
| }.toNot(throwError()) |
There was a problem hiding this comment.
One more thing: could you add some to(equal()) evaluation please?
| }, | ||
| "version" : "1.0" | ||
| } | ||
| """ |
|
|
||
| // Verify the contents of 'strings' dictionary | ||
| expect(decodedData.strings["Login"]).toNot(beNil()) | ||
| expect(decodedData.strings["Login"]?.localizations?["en"]?.stringUnit?.state).to(equal("translated")) |
There was a problem hiding this comment.
Eventually we want to use Decodable for all these JSON objects, but this PR is good as is.
#1
I implemented the model according to the Json data listed in issue, but the actual json is more complex, so I commented out the model made for those extra attributes.