Generated PreviewModels swift file has no access to preview files from Swift local packages #32
Replies: 37 comments 2 replies
-
It seems PR 21 is a possible solution? Any ETA on this? |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
-
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? |
Beta Was this translation helpful? Give feedback.
-
I think it's really possible to use a branch now. |
Beta Was this translation helpful? Give feedback.
-
Sounds good. Happy to test :) I added that branch via SPM but when I run the tests I get this |
Beta Was this translation helpful? Give feedback.
-
I can't reproduce it ): |
Beta Was this translation helpful? Give feedback.
-
Tried cleaning everything.. Same issue.. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue when I run the example app.. Let me try again clearing everything :D Nope.. doesn't work. Should I do something extra? |
Beta Was this translation helpful? Give feedback.
-
I've added a couple of changes, can you check on the new version of the branch? |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I have added a new configuration: prefire_configuration:
- imports:
- UIKit
- Foundation
- testable_imports:
- SwiftUI And I fixed a few bugs. |
Beta Was this translation helpful? Give feedback.
-
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/... |
Beta Was this translation helpful? Give feedback.
-
I hope I fixed it) |
Beta Was this translation helpful? Give feedback.
-
Worked once, then it was cleaned and the method was only there once. Do you need some logs or more info? |
Beta Was this translation helpful? Give feedback.
-
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? :) |
Beta Was this translation helpful? Give feedback.
-
I think I found it. |
Beta Was this translation helpful? Give feedback.
-
I understood the problem. I've redesigned the macro filtering system. Now it will enable all macros along the path of the main target. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Let me try create a sample app :) |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example project! I found the problem and posted a fix. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Working great now. It generated 300 snapshots now of our SwiftUI Screens :) What is the progress on the 2.0? |
Beta Was this translation helpful? Give feedback.
-
Version 2.0 is almost ready. It remains to complete the tests and documentation) |
Beta Was this translation helpful? Give feedback.
-
@BarredEwe Hi, thanks for version 2! Works great locally but having issues to run it on our CI. What am I doing wrong? I also want to look for an iphoneos folder instead of the iphonesimulator folder? Always get this issue |
Beta Was this translation helpful? Give feedback.
-
I updated the example app with Fastlane support and it seems the generated file does not use the .prefire.yml file? It doesn't contained the testable imports.. Full project with Fastlane.
Running it in Xcode works perfect.. |
Beta Was this translation helpful? Give feedback.
-
I think I found an initial problem. When we use Fastlane, we fetch SPM packages in a SourcePackages folder + we use a custom DerivedData folder in the root of the project. So we can clean/cache those afterwards. But the build tool plugin has issues with those files. When I update the paths (outside of the root of the project or just the default ones) it continues to build and then I have the same issue as in the example test project. The generated file does not seems to use the .prefile.yml config file (so target and testable_imports are not used..) and the test build fails. Any idea how to make this work via Fastlane? |
Beta Was this translation helpful? Give feedback.
-
So it looks in another DerivedData folder (in the root of the project). |
Beta Was this translation helpful? Give feedback.
-
If you add this file (unzipped) somewhere in the root, you will get the error. |
Beta Was this translation helpful? Give feedback.
-
@BarredEwe Found a solution for my initial problem (when I run the tests via fastlane it did not find the .prefire.yml file (or didn't use it)) ==> Via Fastlane I was running the tests via my So only "issue" that remains is defining the correct Source folder or excluding a folder. Thanks! |
Beta Was this translation helpful? Give feedback.
-
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?
Beta Was this translation helpful? Give feedback.
All reactions