File tree 3 files changed +16
-3
lines changed
CountryPicker/CountryPicker/Classes/CountryInfo
CountryPickerDemo/CountryPickerDemo
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -42,4 +42,12 @@ public class Country: NSObject {
42
42
self . name = name
43
43
self . localeId = localeId
44
44
}
45
+
46
+ public override var description : String {
47
+ return " \n { \n index: \( self . index) , \n "
48
+ + " country: \( self . name) , \n "
49
+ + " isoCountryCode: \( self . isoCountryCode) , \n "
50
+ + " localeId: \( self . localeId) , \n "
51
+ + " flagImageName: \( self . flagImageName!) \n } "
52
+ }
45
53
}
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public class CountryListManager {
16
16
// MARK: -
17
17
var countryListReady : Bool
18
18
var ommitedCountriesArr : [ String ] = [ ] // Some countries have to be omitted because they don't have Flags
19
- var countries : [ Country ] = [ ]
19
+ public var countries : [ Country ] = [ ]
20
20
var countryFlagImageArr : [ String ] = [ ]
21
21
22
22
// Initialization
Original file line number Diff line number Diff line change @@ -27,10 +27,15 @@ class ViewController: UIViewController {
27
27
28
28
// TextFieldDelegate
29
29
countryTxtFld. delegate = self
30
+
31
+ // fetch a list of countries
32
+ let countryListManager = CountryListManager . shared
33
+ let countriesArr = countryListManager. countries
34
+ print ( " Countries: \( String ( describing: countriesArr) ) " )
30
35
}
31
36
}
32
37
33
- extension ViewController : CountryPickerTableViewControllerDelegate {
38
+ extension ViewController : CountryPickerTableViewControllerDelegate {
34
39
35
40
func didSelectCountry( country: Country ? ) {
36
41
if country != nil {
@@ -41,7 +46,7 @@ extension ViewController : CountryPickerTableViewControllerDelegate {
41
46
}
42
47
}
43
48
44
- extension ViewController : UITextFieldDelegate {
49
+ extension ViewController : UITextFieldDelegate {
45
50
46
51
func textFieldDidBeginEditing( _ textField: UITextField ) {
47
52
textField. resignFirstResponder ( )
You can’t perform that action at this time.
0 commit comments