Skip to content

Commit

Permalink
Notify delegate when selected country is set programmatically.
Browse files Browse the repository at this point in the history
  • Loading branch information
kizitonwose committed Apr 18, 2020
1 parent 8ad8fdf commit d8e3b63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CountryPickerView/CountryPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 105,7 @@ public class CountryPickerView: NibView {
}
set {
_selectedCountry = newValue
delegate?.countryPickerView(self, didSelectCountry: newValue)
setup()
}
}
Expand Down Expand Up @@ -202,7 203,7 @@ public class CountryPickerView: NibView {
//MARK: Helper methods
extension CountryPickerView {
public func setCountryByName(_ name: String) {
if let country = countries.first(where: { $0.name == name }){
if let country = countries.first(where: { $0.name == name }) {
selectedCountry = country
}
}
Expand Down
1 change: 0 additions & 1 deletion CountryPickerView/CountryPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 197,6 @@ extension CountryPickerViewController {

let completion = {
self.countryPickerView.selectedCountry = country
self.countryPickerView.delegate?.countryPickerView(self.countryPickerView, didSelectCountry: country)
}
// If this is root, dismiss, else pop
if navigationController?.viewControllers.count == 1 {
Expand Down

0 comments on commit d8e3b63

Please sign in to comment.