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

Feature/testing refactoring #15

Closed charJin closed 8 months ago

charJin commented 8 months ago

Pull Request: EnumString Refactoring, Add Basic Tests, Other Fixes

Description

This pull request addresses two identified issues in EnumString.

The changes include refactoring the project structure, introducing unit tests, and fixing a few bugs.

Issues Resolved

Changes Made

Checklist

Additional Comments

After updating my Xcode(15.1), I ran into problems importing the module into the test file.

I tried looking into this, but couldn’t find any problems with the Package.swift.

Need Confirmation if this is a Xcode version problem.

superarts commented 8 months ago

@charJin very good work so far. I'm still reviewing it. But to answer your question, it is not necessary (and not recommended) to use Xcode to manage this project.

I purposely omitted some essential steps and wanted to see if candidates would be able to figure out how this project is managed, or ask me this question. Since you asked in your PR description, I'm happy to point you the right path.

In fact, if you see a project with only Packages.swift without any xcproj (and xcworkspace, of course), it's very likely that Xcode is not needed. For these projects, use terminal to cd to the project root path, and run swift build or swift test - you should be able to build the executable or run unit tests.

(In case you are curious, this approach has 2 benefits at least:

  1. Packages.swift is much smaller than Xcode project file, and it's Swift so it's much more manageable. You can use an IDE if you want, but an IDE is not needed.
  2. Xcode is only available on macOS, while this tool could be potentially built on Linux, if needed, for example running it on a Linux runner on CI to make cost cheaper.)

Furthermore, when you see a Makefile, you can run make in command line and build the project. Makefile defines what make actually does for the specific context, so make sure to view its contents first (for example, I could add rm -rf ~/Library and if you blindly run this Makefile, your computer will be screwed - always check a script before you run it to avoid malicious code). make can be used in very complex projects but it's not hard to read and understand, google or use chatgpt if you need some starting point.

I hope the comments above will help you clean up some fogs.

superarts commented 8 months ago

One more thing: the detailed PR description is much appreciated, but please make the PR title more descriptive. Also, when you copy PR templates from other places, make sure to review the checkboxes to make sure they reflect the actual status of your PR.

charJin commented 8 months ago

Updates

I have added the "StringCatalogEnumLibrary" into the Package.swift and Source file. To make it more easily testable, I have moved the StringEnumHelper struct to this library module which both the StringCatalogEnumTests and the main StringCatalogEnum Module would depend on.

I have confirmed that the tests made all pass.

charJin commented 8 months ago

@superarts Hello! I know it's a busy season, but in case the notification slipped through, I just wanted to touch base regarding pull request #15. I'm curious if there are any updates. I'd love to hear your thoughts or address any feedback. Thanks!

superarts commented 8 months ago

Sorry I've been busy dealing with some personal issues in the holiday season. We will go back to this PR later, but I'd like to proceed as you already demonstrated your skill in this PR.

charJin commented 8 months ago

Okay! Thanks for the reply :)

superarts commented 8 months ago

I'm closing this PR as I'm generally very happy with the quality of it. For more info:

Great job @charJin and welcome onboard!