{"id":2041,"url":"https://github.com/iziz/libPhoneNumber-iOS","last_synced_at":"2025-08-02T23:31:28.688Z","repository":{"id":14492195,"uuid":"17205044","full_name":"iziz/libPhoneNumber-iOS","owner":"iziz","description":"iOS port from libphonenumber (Google's phone number handling library)","archived":false,"fork":false,"pushed_at":"2024-08-25T15:34:39.000Z","size":19843,"stargazers_count":2358,"open_issues_count":117,"forks_count":465,"subscribers_count":69,"default_branch":"master","last_synced_at":"2024-10-29T15:38:24.780Z","etag":null,"topics":["cocoapods","libphonenumber","objective-c"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iziz.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,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-26T09:09:15.000Z","updated_at":"2024-10-28T13:15:00.000Z","dependencies_parsed_at":"2023-02-15T11:46:34.403Z","dependency_job_id":"64c8cafc-502e-4d62-a2f8-82691652a912","html_url":"https://github.com/iziz/libPhoneNumber-iOS","commit_stats":{"total_commits":529,"total_committers":72,"mean_commits":7.347222222222222,"dds":0.6143667296786389,"last_synced_commit":"a6f5cb0a2a264e8396da65b0fb27ecf0df8a975e"},"previous_names":[],"tags_count":43,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iziz%2FlibPhoneNumber-iOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iziz%2FlibPhoneNumber-iOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iziz%2FlibPhoneNumber-iOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iziz%2FlibPhoneNumber-iOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iziz","download_url":"https://codeload.github.com/iziz/libPhoneNumber-iOS/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225844822,"owners_count":17533161,"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":["cocoapods","libphonenumber","objective-c"],"created_at":"2024-01-05T20:16:01.936Z","updated_at":"2024-12-06T17:30:31.580Z","avatar_url":"https://github.com/iziz.png","language":"Objective-C","funding_links":[],"categories":["Phone Numbers","Objective-C","UI","Text","Foundation"],"sub_categories":["Layout","Other free courses","Other Testing","Keychain"],"readme":"[![CocoaPods](https://img.shields.io/cocoapods/p/libPhoneNumber-iOS.svg?style=flat)](http://cocoapods.org/?q=libPhoneNumber-iOS)\n[![CocoaPods](https://img.shields.io/cocoapods/v/libPhoneNumber-iOS.svg?style=flat)](http://cocoapods.org/?q=libPhoneNumber-iOS)\n[![Travis](https://travis-ci.org/iziz/libPhoneNumber-iOS.svg?branch=master)](https://travis-ci.org/iziz/libPhoneNumber-iOS)\n[![Coveralls](https://coveralls.io/repos/iziz/libPhoneNumber-iOS/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/iziz/libPhoneNumber-iOS?branch=master)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\n# **libPhoneNumber for iOS**\n\n - NBPhoneNumberUtil\n - NBAsYouTypeFormatter\n\n\u003e ARC only\n\n## Update Log\n[https://github.com/iziz/libPhoneNumber-iOS/wiki/Update-Log](https://github.com/iziz/libPhoneNumber-iOS/wiki/Update-Log)\n\n\n## Issue\nYou can check phone number validation using below link.\nhttps://rawgit.com/googlei18n/libphonenumber/master/javascript/i18n/phonenumbers/demo-compiled.html\n\nPlease report, if the above results are different from this iOS library.\nOtherwise, please create issue to following link below to request additional telephone numbers formatting rule.\nhttps://github.com/google/libphonenumber/issues\n\nMetadata in this library was generated from that. so, you should change it first. :)\n\n## Install\n\n#### Using [CocoaPods](http://cocoapods.org/?q=libPhoneNumber-iOS)\n```\nsource 'https://github.com/CocoaPods/Specs.git'\npod 'libPhoneNumber-iOS', '~\u003e 0.8'\n```\n##### Installing libPhoneNumber Geocoding Features\n```\npod 'libPhoneNumberGeocoding', :git =\u003e 'https://github.com/CocoaPods/Specs.git'\n```\n\n#### Using [Carthage](https://github.com/Carthage/Carthage)\n\n Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.\n\n You can install Carthage with [Homebrew](http://brew.sh/) using the following command:\n\n```bash\n$ brew update\n$ brew install carthage\n```\n\nTo integrate libPhoneNumber into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"iziz/libPhoneNumber-iOS\"\n```\n\nAnd set the **Embedded Content Contains Swift** to \"Yes\" in your build settings.\n\n#### Setting up manually\n Add source files to your projects from libPhoneNumber\n    - Add \"Contacts.framework\"\n\nSee sample test code from\n\u003e [libPhoneNumber-iOS/libPhoneNumberTests/ ... Test.m] (https://github.com/iziz/libPhoneNumber-iOS/tree/master/libPhoneNumberTests)\n\n## Usage - **NBPhoneNumberUtil**\n```obj-c\n NBPhoneNumberUtil *phoneUtil = [NBPhoneNumberUtil sharedInstance];\n NSError *anError = nil;\n NBPhoneNumber *myNumber = [phoneUtil parse:@\"6766077303\"\n                              defaultRegion:@\"AT\" error:\u0026anError];\n if (anError == nil) {\n     NSLog(@\"isValidPhoneNumber ? [%@]\", [phoneUtil isValidNumber:myNumber] ? @\"YES\":@\"NO\");\n\n     // E164          : +436766077303\n     NSLog(@\"E164          : %@\", [phoneUtil format:myNumber\n                                       numberFormat:NBEPhoneNumberFormatE164\n                                              error:\u0026anError]);\n     // INTERNATIONAL : +43 676 6077303\n     NSLog(@\"INTERNATIONAL : %@\", [phoneUtil format:myNumber\n                                       numberFormat:NBEPhoneNumberFormatINTERNATIONAL\n                                              error:\u0026anError]);\n     // NATIONAL      : 0676 6077303\n     NSLog(@\"NATIONAL      : %@\", [phoneUtil format:myNumber\n                                       numberFormat:NBEPhoneNumberFormatNATIONAL\n                                              error:\u0026anError]);\n     // RFC3966       : tel:+43-676-6077303\n     NSLog(@\"RFC3966       : %@\", [phoneUtil format:myNumber\n                                       numberFormat:NBEPhoneNumberFormatRFC3966\n                                              error:\u0026anError]);\n } else {\n     NSLog(@\"Error : %@\", [anError localizedDescription]);\n }\n\n NSLog (@\"extractCountryCode [%@]\", [phoneUtil extractCountryCode:@\"823213123123\" nationalNumber:nil]);\n\n NSString *nationalNumber = nil;\n NSNumber *countryCode = [phoneUtil extractCountryCode:@\"823213123123\" nationalNumber:\u0026nationalNumber];\n\n NSLog (@\"extractCountryCode [%@] [%@]\", countryCode, nationalNumber);\n```\n##### Output\n```\n2014-07-06 12:39:37.240 libPhoneNumberTest[1581:60b] isValidPhoneNumber ? [YES]\n2014-07-06 12:39:37.242 libPhoneNumberTest[1581:60b] E164          : +436766077303\n2014-07-06 12:39:37.243 libPhoneNumberTest[1581:60b] INTERNATIONAL : +43 676 6077303\n2014-07-06 12:39:37.243 libPhoneNumberTest[1581:60b] NATIONAL      : 0676 6077303\n2014-07-06 12:39:37.244 libPhoneNumberTest[1581:60b] RFC3966       : tel:+43-676-6077303\n2014-07-06 12:39:37.244 libPhoneNumberTest[1581:60b] extractCountryCode [82]\n2014-07-06 12:39:37.245 libPhoneNumberTest[1581:60b] extractCountryCode [82] [3213123123]\n```\n\n#### with Swift\n##### Case (1) with Framework\n```\nimport libPhoneNumberiOS\n```\n\n##### Case (2) with Bridging-Header\n```obj-c\n// Manually added\n#import \"NBPhoneNumberUtil.h\"\n#import \"NBPhoneNumber.h\"\n\n// CocoaPods (check your library path)\n#import \"libPhoneNumber_iOS/NBPhoneNumberUtil.h\"\n#import \"libPhoneNumber_iOS/NBPhoneNumber.h\"\n\n// add more if you want...\n```\n\n##### Case (3) with CocoaPods\nimport libPhoneNumber_iOS\n\n\n##### - in swift class file\n###### 2.x\n```swift\noverride func viewDidLoad() {\n    super.viewDidLoad()\n\n    guard let phoneUtil = NBPhoneNumberUtil.sharedInstance() else {\n        return\n    }\n\n    do {\n        let phoneNumber: NBPhoneNumber = try phoneUtil.parse(\"01065431234\", defaultRegion: \"KR\")\n        let formattedString: String = try phoneUtil.format(phoneNumber, numberFormat: .E164)\n\n        NSLog(\"[%@]\", formattedString)\n    }\n    catch let error as NSError {\n        print(error.localizedDescription)\n    }\n}\n```\n\n## Usage - **NBAsYouTypeFormatter**\n```obj-c\n NBAsYouTypeFormatter *f = [[NBAsYouTypeFormatter alloc] initWithRegionCode:@\"US\"];\n    NSLog(@\"%@\", [f inputDigit:@\"6\"]); // \"6\"\n    NSLog(@\"%@\", [f inputDigit:@\"5\"]); // \"65\"\n    NSLog(@\"%@\", [f inputDigit:@\"0\"]); // \"650\"\n    NSLog(@\"%@\", [f inputDigit:@\"2\"]); // \"650 2\"\n    NSLog(@\"%@\", [f inputDigit:@\"5\"]); // \"650 25\"\n    NSLog(@\"%@\", [f inputDigit:@\"3\"]); // \"650 253\"\n\n    // Note this is how a US local number (without area code) should be formatted.\n    NSLog(@\"%@\", [f inputDigit:@\"2\"]); // \"650 2532\"\n    NSLog(@\"%@\", [f inputDigit:@\"2\"]); // \"650 253 22\"\n    NSLog(@\"%@\", [f inputDigit:@\"2\"]); // \"650 253 222\"\n    NSLog(@\"%@\", [f inputDigit:@\"2\"]); // \"650 253 2222\"\n    // Can remove last digit\n    NSLog(@\"%@\", [f removeLastDigit]); // \"650 253 222\"\n\n    NSLog(@\"%@\", [f inputString:@\"16502532222\"]); // 1 650 253 2222\n```\n\n## libPhoneNumberGeocoding\n\nFor more information on libPhoneNumberGeocoding and its usage, please visit [libPhoneNumberGeocoding](https://github.com/iziz/libPhoneNumber-iOS/blob/master/libPhoneNumberGeocoding/README.md) for more information.\n\n## libPhoneNumberShortNumber\n\nFor more information on libPhoneNumberShortNumber and its usage, please visit [libPhoneNumberShortNumber](https://github.com/iziz/libPhoneNumber-iOS/blob/master/libPhoneNumberShortNumber/README.md) for more information.\n\n##### Visit [libphonenumber](https://github.com/google/libphonenumber) for more information or mail (zen.isis@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiziz%2FlibPhoneNumber-iOS","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiziz%2FlibPhoneNumber-iOS","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiziz%2FlibPhoneNumber-iOS/lists"}