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
Use generics to replace AnyView #22
Comments
@johnnythedoggie Thank you for bringing this up! I absolutely agree with you. Would you like to tackle this and open a pull request? If not, I will take care of this. |
@johnnythedoggie I would appreciate it if you can work on this and open a PR. It looks nice to have more than 1 contributor. New version is out, my goal is to implement this by v1.1.1 |
@jevonmao I'm still learning GitHub, so it may take me a bit. I do plan to open a PR and make the change, but I'm confused how to do that. I'll figure it out soon (hopefully) and go for it. I'll ask if I have questions. |
@johnnythedoggie No problem at all. Pull request is actually a Github exclusive feature (not Git), and everything related your will do on the Github website. A pull request or PR is simply a request to contribute your code changes. As the owner, I will be able to see all your additions and deletions to the code. At the end, I will "merge" your code into this existing repository so your hard work pays off. If you are not sure, read this article that guides you through the entire process. For step 3, simply name the branch Make sure you also have Xcode installed to code on the project. |
@johnnythedoggie Are you still interested in working on this issue? Just give me a status update please. If not, I will go ahead and do it. |
I tried to do this, but for variety reasons, the |
Using AnyView is bad practice, and if it can be replaced (and I believe it can in this case) it should be. With just a few changes, MainView.swift would be modified to look like this:
AnyView is used in many places and most (if not all) of them can be replaced with generics. This won't break anyone's existing code either, the type will not be MainView, it will be MainView<AnyView>. AnyView should be switched for generics in JMPermission (for the imageIcon) as well. This helps SwiftUI update views more efficiently and prevents always casting the image to AnyView like is currently in the README:
The text was updated successfully, but these errors were encountered: