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
Make Code Injection Working For UI #2
Conversation
I can't find an elegant way to avoid to write
every time. Help is welcome :) |
SUCCESS!!! 🚀 In the app delegate invoke
In your For views that are not No XCode plugins, nor project changes are required (unlike the old version I've implemented in objc). It is enough to download this app Clean build -> run the project That's it :D |
@lucaquerella @smaramba @frankdilo @sroddy The only point to fix is the |
my last commits address the issue with |
SGTM |
I have the strong feeling that if we manage to have a quick-to-setup injection when it comes to UI, we can drastically reduce the amount of time it takes to styles application, as we can live reloads tweaks without recompiling the swift project, which can be extremely slow for large applications.
Unfortunately, the code injection doesn't work for generic classes, as these are not exposed to the objc runtime and therefore cannot be dynamically reloaded. Tempura heavily uses generic classes and in particular the
ModellableView
is a generic subclass ofUIView
Me and @smaramba decided to have two separated branches. Master will keep the generic class approach, while this branch will try the PAT path. Video Editor will use the master branch while VPN (if we decide to use tempura) will use this branch. After some time we will evaluate pros/cons of the two approaches and we will decide which is the best approach.
There are 3 steps I want to follow to try this approach:
1 - Refactor the project so that
ModellableView
is a PAT (DONE)2 - Reduce the boilerplate introduced by the fact that we use a PAT and not a subclass (DONE)
3 - Find a method to make live reload works out of the box in the UI (DONE)
One of the biggest challenges will be to keep this branch in sync feature-wise with master.