-
Notifications
You must be signed in to change notification settings - Fork 86
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
Customization of countries list #76
Conversation
Codecov Report
@@ Coverage Diff @@
## master #76 +/- ##
==========================================
+ Coverage 94.06% 94.08% +0.01%
==========================================
Files 17 17
Lines 1214 1217 +3
==========================================
+ Hits 1142 1145 +3
Misses 72 72
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 comment rest looks fine
let countryCodes = try! getCountryCodes() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we throws backs instead of generating crash here.
let countryCodes = try! getCountryCodes()
uses
let countryCodes = try getCountryCodes()
because loadCountries
can throw itself
If we have a single shared instance in place why do we need to reassign What do you think of this approach? @SURYAKANTSHARMA cc/ @freakdragon
|
CountryManager.shared = countryManager Good Catch @Sharkesm |
May be I didn't fully understand something, but when I tried to override CountryManager with closed init function, I couldn't do it. And without it I couldn't extend CountryManager class for overriding of |
|
Sure. Nothing is wrong in your approach. It just that we are thinking of if we can do better because Singleton pattern don't allow to make init public https://refactoring.guru/design-patterns/singleton/swift/example. Read Example.swift. You will better understand. |
If you'll check analog libraries (iOS and Android) you can notice that most of those have |
@Sharkesm wdyt ? |
Also you can change/add delegate which will have methods |
Yes, I agree with this we could actually move those into delegate methods |
@Sharkesm and what do you think about excluded countries functionality? |
@freakdragon You raised a valid point on allowing users to have their own country loading implementation, though I reckon we could expose certain functions to exclude countries as expected without breaking the singleton practice, or else we could give a look at other implementation that could satisfy your proposed requirements. |
@Sharkesm there will be enough to move methods getCountryCodes() and loadCountries() to delegate. After implementing of this functionality we can think about exluded countries if it will be neccessary for somebody. |
Yes, I agree with this then it's a green light from my end 🚀 🤖 |
Any update here @freakdragon |
Unfortunately, I don't have time to implement now. Working two jobs. If I'll have some free time, than I'll think how to implement it. |
Closing for now Feel free to reopen if needed |
This improvement will allow to customize countries list in more ways.
This will allow to use code like this: