-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Good practice improvements discussion #168
Comments
Thanks for opening this up! Here are my comments:
I used it and it didn't give me any extra advantages. If you want to add it go ahead, but it's not necessary in my opinion. Also, it should be seamless to integrate using CocoaPods and a run script.
For faster development, I don't do that, because by convention you should never assign anything else to an
This is a different issue. It's mostly caused by the
I think this solution is definitely debatable. I use Conclusion
My thoughts are you shouldn't refactor the project as it would take some valuable time that should be invested in new features that we plan on having. But if you want to implement these in the future code you write, be my guest 👍 |
@colcalex while cleaning up the repo a bit after a while, I think some of the suggestions you raised make sense in going forward. I still don't think we should refactor the old code, but if you have the time and patience, no problem.
Thank you again for raising these up! |
Hi, sorry for opening this issue here but I'm not sure where to ask. Happy to move discussion somewhere else if not happy to have it here.
You may be familiar with it, it's a very powerful tool to enforce syntax and some concepts within a project. I think it's especially useful on larger projects, or projects with more contributors.
👍
👎
Generally it is good practice for the UI to be only accessible via it's owner (VC, view) and not by the parent of the UI owner. Although they are constants and cannot be overridden, they are reference types and as such can be modifier by an external user. For example, when creating a view, try calling
view.outletElement.removeFromSuperview()
. This usually results inoutletElement
becoming nil. Given it's a forced unwrapped property, this will cause a crash the moment it's accessed by its actual owner (the view). This is just one example, potentially there are many ways developer error can cause unintended consequences for exposed UI elements.👍
👎
Brief description from
HackingWithSwift
Swift Docs on Access Control
fileprivate
allows something to be accessible by anything within the same file. Looking through the project, that is hardly ever the case andprivate
would be a more appropriate access control setting.👍
👎
These are all changes I'm happy to make if there is an agreement to go ahead. They may cause a lot of syntactic changes so could also be implemented little by little while touching parts of code that are affected.
SwiftLint is great for number (2) as it can prevent building project altogether if there is an agreement to consider that a serious issue.
I look forward to a debate on the merits of these ideas 😄
The text was updated successfully, but these errors were encountered: