-
Notifications
You must be signed in to change notification settings - Fork 24
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated PreviewModels swift file has no access to preview files from Swift local packages #31
Comments
It seems PR 21 is a possible solution? Any ETA on this? |
I'm currently working on a new major release #29 with a lot of improvements. In particular, the ability to install custom imports has been added:
|
Sounds great! Our packages also have tests, is that supported? So we run the test in the main project and snapshot tests from the packages are verified? So in test_configuration target would be just our main target? When do you think it could be released? so would be a good usecase to test v2, right? |
I think it's really possible to use a branch now. |
I can't reproduce it ): |
Tried cleaning everything.. Same issue.. |
I've added a couple of changes, can you check on the new version of the branch? |
I have added a new configuration: prefire_configuration:
- imports:
- UIKit
- Foundation
- testable_imports:
- SwiftUI And I fixed a few bugs. |
Thanks! Playbook (PreviewModels.generated) is working now with @testable import Presentation PreviewTests is still failing because of Invalid redeclaration of 'test_SelectCoHolderTestPreview_Preview()' What can I do to fix that? Already cleaned DerrivedData/SPM cache/... |
I hope I fixed it) |
Worked once, then it was cleaned and the method was only there once. Do you need some logs or more info? |
Let me try to reproduce it with the example app :) |
Everything that is generated by macros is in one folder. Now the filtering is very simple (search for the inclusion of the project name in the file name). I'll try to figure out how to improve it. |
I have added a new macro file filtering. Macros from another project should no longer be included |
Thanks! That's working. But I still have an issue ==> I need multiple testable imports Our structure: How can we have that?
And in the generated PreviewTests file it is combining the test from AppTests target + packages. So it needs to have multiple @testable import statements. For example the generated file now has:
But in my case it could better be
because now it finds the previews from the Presentation package but it also generated the preview tests for the DesignSwiftUI package but it doesn't find those files :) Thanks!! |
Added parameter setting for test_configuration (same as for playbook_configuration): test_configuration:
- required_os: 17
- imports:
- UIKit
- SwiftUI
- testable_imports:
- Prefire |
Thanks! It's working!! π₯³ But I think I found an issue regarding the Macro's. I updated the test_configuration target to AppName_STUB_Debug as this is the main App module for the tests. And so it would create the snapshots in the AppName_STUB_Debug folder, instead of the Presentation folder. So I have 2 testable imports (via the config) + 1 import added via the target @testable import Argenta_STUB_Debug But when I do that, the macro previews are not included in the PreviewTests file, only the ones from PreviewProvider.
How can we fix that? :) Almost there! Thanks for the great work and effort! EDIT: I think we should combine all the preview bodies, not only from specified target but also from the testable import targets? |
And I tried to build it via our CI and got this issue error: βPrefirePlaybookPluginβ must be enabled before it can be used On Xcode I get a popup to trust the plugin.. But hmm how should we do that on CI? :) |
I think I found it. |
I understood the problem. I've redesigned the macro filtering system. Now it will enable all macros along the path of the main target. |
Let me try create a sample app :) |
So I created an example app with 2 Swift Packages. Presentation has an AuthView and Design has PrefireView But here also have an issue ==> Good thing is that it adds the preview macro's from the packages |
Thanks for the example project! I found the problem and posted a fix. |
Thanks. Working great now. It generated 300 snapshots now of our SwiftUI Screens :) What is the progress on the 2.0? |
Version 2.0 is almost ready. It remains to complete the tests and documentation) |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Context π΅οΈββοΈ
We have rather big project with some local SPM local packages. In those packages we have SwiftUI screens and components.
I added Prefire to the project and package and updated a SwiftUI preview in the local package to use PrefireProvider.
But then the project generated the PreviewModels file but it has no access to
AppointmentDetailsScreen_Previews is part of Presentation package and that package isn't imported or cannot be accessed.. How can I do that?
Can I update the PreviewModels template file?
The text was updated successfully, but these errors were encountered: