{"id":19328223,"url":"https://github.com/jndisrupter/jnphonenumberview","last_synced_at":"2025-08-21T17:06:19.056Z","repository":{"id":35561271,"uuid":"215594499","full_name":"JNDisrupter/JNPhoneNumberView","owner":"JNDisrupter","description":"Phone Number Validation with country dial code picker","archived":false,"fork":false,"pushed_at":"2024-08-27T08:53:59.000Z","size":19493,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T17:01:46.019Z","etag":null,"topics":["country","country-codes","country-flags","country-list","country-picker","country-selection","country-selector","international-phone-codes","international-phone-validator","international-phone-view","ios","ios-swift","iso3166","libphonenumber","libphonenumber-swift","library","phone-number","phonenumber-validation","swift","swift5"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JNDisrupter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-16T16:29:27.000Z","updated_at":"2024-08-27T08:53:31.000Z","dependencies_parsed_at":"2022-08-08T09:16:12.392Z","dependency_job_id":null,"html_url":"https://github.com/JNDisrupter/JNPhoneNumberView","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JNDisrupter%2FJNPhoneNumberView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JNDisrupter%2FJNPhoneNumberView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JNDisrupter%2FJNPhoneNumberView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JNDisrupter%2FJNPhoneNumberView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JNDisrupter","download_url":"https://codeload.github.com/JNDisrupter/JNPhoneNumberView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250328157,"owners_count":21412572,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["country","country-codes","country-flags","country-list","country-picker","country-selection","country-selector","international-phone-codes","international-phone-validator","international-phone-view","ios","ios-swift","iso3166","libphonenumber","libphonenumber-swift","library","phone-number","phonenumber-validation","swift","swift5"],"created_at":"2024-11-10T02:21:01.491Z","updated_at":"2025-04-22T21:30:42.816Z","avatar_url":"https://github.com/JNDisrupter.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JNPhoneNumberView\n\n[![CI Status](https://img.shields.io/travis/hamzakhanfar/JNPhoneNumberView.svg?style=flat)](https://travis-ci.org/hamzakhanfar/JNPhoneNumberView)\n[![Version](https://img.shields.io/cocoapods/v/JNPhoneNumberView.svg?style=flat)](https://cocoapods.org/pods/JNPhoneNumberView)\n[![License](https://img.shields.io/cocoapods/l/JNPhoneNumberView.svg?style=flat)](https://cocoapods.org/pods/JNPhoneNumberView)\n[![Platform](https://img.shields.io/cocoapods/p/JNPhoneNumberView.svg?style=flat)](https://cocoapods.org/pods/JNPhoneNumberView)\n\n## Requirements\n\n- iOS 12.0+ / macOS 14.4+\n- Xcode 15.3+\n- Swift 5+\n\n\n## Installation\n\nJNPhoneNumberView is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'JNPhoneNumberView'\n```\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n## JNPhoneNumberView\n\nused to to show the country dial code and the phone number, you can click on the dial code and select another country from the countries picker, this view has a delegate methods to pass the international number and validity of it.\n\n### Screenshots\n\u003cimg src=\"https://user-images.githubusercontent.com/5199603/67772070-20783a80-fa62-11e9-8561-b4ecb5789c60.png\" width=\"200\" height=\"400\"/\u003e        \u003cimg src=\"https://user-images.githubusercontent.com/5199603/67772097-2d952980-fa62-11e9-8eb8-2c9aec955bb1.png\" width=\"200\" height=\"400\"/\u003e        \u003cimg src=\"https://user-images.githubusercontent.com/5199603/67772140-3c7bdc00-fa62-11e9-94f8-7c69fca5c7ae.gif\" width=\"200\" height=\"400\"/\u003e        \u003cimg src=\"https://user-images.githubusercontent.com/5199603/67772169-47cf0780-fa62-11e9-9391-a4fafa6cfc47.gif\" width=\"200\" height=\"400\"/\u003e\n\n### Usage\n\n- #### To add JNPhoneNumberView in interface builder:\n\n    1. Drag an UIView and change the class to \"JNPhoneNumberView\"\n\n    2. Add refrence for it in the view controller.\n\n- #### Implement JNPhoneNumberViewDelegate:\n\n     Set the 'delegate' in your view controller and implement the following methods:\n        \n     - Presenter View Controller to be used for presenting the Country list picker:\n        \n          ```swift\n          func phoneNumberView(getPresenterViewControllerFor phoneNumberView: JNPhoneNumberView) -\u003e UIViewController\n          ```\n        \n     - Get Country picker configuration:\n        ```swift\n        func phoneNumberView(getCountryPickerAttributesFor phoneNumberView: JNPhoneNumberView) -\u003e JNCountryPickerConfiguration\n        ```\n    \n     -  Did change text with new national phone number and selected country:\n        ```swift\n        func phoneNumberView(didChangeText nationalNumber: String, country: JNCountry, forPhoneNumberView phoneNumberView: JNPhoneNumberView)\n        ``` \n     \n     -  Did end editing with bool value indicate if the phone number is valid, new national phone number and selected country:\n        ```swift\n        func phoneNumberView(didEndEditing nationalNumber: String, country: JNCountry, isValidPhoneNumber: Bool, forPhoneNumberView phoneNumberView: JNPhoneNumberView)\n        ``` \n        \n     -  Selected Country did changed with bool value indicate if the phone number is valid:\n        ```swift\n        func phoneNumberView(countryDidChanged country: JNCountry, isValidPhoneNumber: Bool, forPhoneNumberView phoneNumberView: JNPhoneNumberView)\n        ``` \n\n- #### Implement JNPhoneNumberViewDataSourceDelegate:\n    Set dataSourceDelegate in your view controller if you want to provide a source with custom countries instead of using the our like the following:\n\n    ```swift\n    func countryPickerViewControllerLoadCountryList(_ phoneNumberView: JNPhoneNumberView, completion: @escaping ([JNCountry]) -\u003e Void, errorCompletion: @escaping (NSError) -\u003e Void)\n    ```\n- #### View Customization:\n    We provide appearance customization using **JNPhoneNumberViewConfiguration** that has the following attributtes:\n    \n     - ***countryDialCodeTitleColor*** Color for country dial code.\n     - ***countryDialCodeTitleFont:*** Font for country dial code.    \n     - ***phoneNumberTitleColor:*** Color for phone number textfield.\n     - ***phoneNumberTitleFont:*** Font for phone number textfield.\n     - ***phoneNumberPlaceHolder:*** Place hodler for phone number textfield.\n     - ***leftToolBarBarButtonItemTitle:*** Title for Tool BarBar ButtonItem that appear of Keyboard.\n     - ***maximumNumbrOfDigits:***  Maximum number of digits allowed to add. the defualt value is 30 digit\n\n#### Public Methods:\n1. Set a default country using this method, you just have to pass a country code such as \"US\", \"PS\":\n    ```swift\n    func setDefaultCountryCode(defaultCountryCode: String) \n    ```\n2. Set View configuration to customization view appearance:\n    ```swift\n    func setViewConfiguration(_ configuration: JNPhoneNumberViewConfiguration) \n    ```\n3. Set phone number in JNPhoneNumberView:\n    ```swift\n    func setPhoneNumber(phoneNumber: String)\n    ```\n4.  Set phone number from national number and country: \n    ```swift\n    func setPhoneNumber(nationalNumber: String, preferredRegionCode: String)\n    ```\n5. Get phone number from JNPhoneNumberView:\n    ```swift\n    func getPhoneNumber() -\u003e String \n    ```\n 6. Is phone number valid:\n    ```swift\n    func isValidPhoneNumber() -\u003e Bool\n    ```\n\n7. Get National Phone Number:\n    ```swift\n    func getNationalPhoneNumber() -\u003e String\n    ```\n\n8. Get dial code:\n    ```swift\n    func getDialCode() -\u003e String\n    ```\n    \n#### Public Properties:\n1. delegate : Picker Delegate\n2. dataSourceDelegate: Data Source Delegate\n\n## JNCountryPickerViewController\n\nused to to show the countries list and select one of the countries, this view controller has a delegate methods to pass the selected country as JNCountry, also we provide the developer the flexiability to pass a custom country list insead of use the cached one.\n\n### Screenshots\n\u003cimg src=\"https://user-images.githubusercontent.com/5199603/67771968-f32b8c80-fa61-11e9-8b1d-3b22145d9e40.png\" width=\"200\" height=\"400\"/\u003e        \u003cimg src=\"https://user-images.githubusercontent.com/5199603/67771812-ad6ec400-fa61-11e9-8ce5-47c8a395812b.gif\" width=\"200\" height=\"400\"/\u003e        \u003cimg src=\"https://user-images.githubusercontent.com/5199603/67771936-e3ac4380-fa61-11e9-88a9-a4a80dc18da8.gif\" width=\"200\" height=\"400\"/\u003e\n\n### Usage\n\n#### To present JNCountryPickerViewController programmatically:\n\n1. Initiate JNCountryPickerViewController.\n    ```swift\n      let countryPickerViewController = JNCountryPickerViewController()\n    ```\n\n2. Emped the view controller in navigation controller.\n    ```swift\n      let nevigationController = UINavigationController(rootViewController: countryPickerViewController)\n    ```\n3. Present the navigation controller modally.\n    ```swift\n      self.present(nevigationController, animated: true, completion: nil)\n    ```\n    \n- ####  Implement JNCountryPickerViewControllerDelegate:\n\n    Set the 'delegate' in your view controller and implement the following methods:\n    \n    - Did select Country\n    ```swift\n    func countryPickerViewController(_ controller: JNCountryPickerViewController, didSelectCountry country: JNCountry)\n    ```\n    \n- ####  Implement JNPhoneNumberViewDataSourceDelegate:\n\n    Set the 'dataSourceDelegate' in your view controller and implement the following methods:\n\n    - Load country list from custom source\n    ```swift\n    func countryPickerViewControllerLoadCountryList(_ controller: JNCountryPickerViewController, completion: @escaping ([JNCountry]) -\u003e Void, errorCompletion: @escaping (NSError) -\u003e Void)\n    ```\n    \n- #### View Customization:\n    We provide appearance customization using **JNCountryPickerConfiguration** that has the following attributtes:\n    \n    - ***selectedTitleFont*** Selected item title font.\n    - ***titleFont*** Not selected item title font.\n    - ***selectedTitleColor*** Selected item title color.\n    - ***titleColor*** Not selected item title color.\n    - ***emptySearchMessageFont*** Message for empty search result.\n    - ***emptySearchMessageColor*** Color for empty search result message.\n    - ***searchBarTintColor*** Search bar tint color.\n    - ***navigationBarColor*** Navigation bar color.\n    - ***naigationBarTintColor*** Navigation bar tint color.\n    - ***navigationBarTitle*** Navigation bar Title.\n    - ***navigationBarTitleTextAttributes*** Navigation bar title text attributtes.\n    - ***selectBarButtonTitle*** Select bar button title.\n    - ***loadingAcivityIndicatorColor*** Loading acivity indicator color.    \n    - ***emptySearchMessage*** Message for empty search result.\n    - ***emptySearchImage*** Image for empty search result.\n    - ***viewBackgroundColor*** View controller background color.\n    - ***pickerLanguage*** Picker language.\n    - ***tableCellInsets*** Cell margins.    \n    - ***tableCellCornerRaduis*** Cell corner raduis.\n    - ***tableCellBackgroundColor*** Cell background color.\n    - ***showDialCode***  Show country dial code to appear after  country name.\n\n#### Public Properties:\n\n1. pickerConfiguration: you can set a custom configuration instead of the default configuration as described in view customization section.\n2. selectedCountry: you can set country to be selected when picker opened.\n2. delegate : Picker Delegate\n3. dataSourceDelegate: Data Source Delegate\n\n## Notes\n\n1. Custom country entitiy must conform to JNCountry protocol that has the following:\n    - ***code*** Country code.\n    - ***name*** Country name.\n    - ***dialCode*** Country dial code.\n    \n    The Country Data should Follow ***ISO 3166-1***\n    \n## Author\n\nHamzeh Khanfar \u0026 Jayel Zaghmoutt\n\n## License\n\nJNPhoneNumberView is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjndisrupter%2Fjnphonenumberview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjndisrupter%2Fjnphonenumberview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjndisrupter%2Fjnphonenumberview/lists"}