superarts / XStringCatalog

A framework that generates enum from xcstring - Swift enumerations from String Catalog for iOS / iPadOS / macOS / tvOS.
MIT License
4 stars 9 forks source link

Model Setup for String Catalog #14

Closed Uni-boy closed 8 months ago

Uni-boy commented 8 months ago

Pull Request: XCString Model Setup, Add Tests, Other Fixes

Description

This pull request introduces the XCString model to our codebase.

The primary goal is to enhance our application's localization capabilities, making it easier to manage and use localized strings.

Related Issue

1

Changes Made

  • Model Creation: Implemented the XCString model, designed to encapsulate localization logic and provide a more structured approach to handling localized strings.
  • Decoding Logic: Added functionality to decode localization data from JSON, enabling dynamic localization based on user preferences or system settings.
  • Unit Tests: Included comprehensive unit tests to validate the functionality of the XCString model, particularly focusing on its ability to correctly handle various localization scenarios.

Checklist

  • [x] I have added appropriate comments/documentation.
  • [x] All existing tests pass, and I have added new tests.
  • [x] The commit messages are clear and follow best practices.

Additional Comments

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.

superarts commented 8 months ago

@Uni-boy is your PR ready for review please?

Uni-boy commented 8 months ago

Yeah my PR is ready.

superarts commented 8 months ago

@Uni-boy if you don't have any plan to update this PR, please feel free to close it. Thank you.

Uni-boy commented 8 months ago

I finalized the model and all tests passed.

superarts commented 8 months ago

I finalized the model and all tests passed.

Please merge from master and resolve conflicts.

More importantly, when I said "these structs should be consumed", I meant the structs you created should replace codes like let strings = json["strings"] as? [String: Any] in main.swift. What do you think the codebase can benefit from some data models that are not used anywhere?

Uni-boy commented 8 months ago

I finalized the model and all tests passed.

Please merge from master and resolve conflicts.

More importantly, when I said "these structs should be consumed", I meant the structs you created should replace codes like let strings = json["strings"] as? [String: Any] in main.swift. What do you think the codebase can benefit from some data models that are not used anywhere?

I applied the model to main.swift and solved the TODO in StringEnumHelper.swift