Skip to content

Commit

Permalink
Release 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroy committed Feb 11, 2016
1 parent 3cf491a commit 9fc5e71
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion PhoneNumberKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "PhoneNumberKit"
s.version = "0.3"
s.version = "0.6"
s.summary = "Swift framework for working with phone numbers"

# This description is used to generate tags and improve search results.
Expand Down
8 changes: 4 additions & 4 deletions PhoneNumberKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand Down Expand Up @@ -371,7 +371,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 11;
CURRENT_PROJECT_VERSION = 12;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand Down Expand Up @@ -401,7 +401,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 11;
DYLIB_CURRENT_VERSION = 12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = PhoneNumberKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -420,7 +420,7 @@
CLANG_ENABLE_MODULES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 11;
DYLIB_CURRENT_VERSION = 12;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = PhoneNumberKit/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand Down
4 changes: 2 additions & 2 deletions PhoneNumberKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.3</string>
<string>0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>11</string>
<string>12</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down
7 changes: 6 additions & 1 deletion PhoneNumberKit/PartialFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ public class PartialFormatter {

//MARK: Lifecycle

convenience init() {
/**
Initialise a partial formatter with the default region

- returns: PartialFormatter object
*/
public convenience init() {
let region = PhoneNumberKit().defaultRegionCode()
self.init(region: region)
}
Expand Down
4 changes: 2 additions & 2 deletions PhoneNumberKitTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>0.3</string>
<string>0.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>11</string>
<string>12</string>
</dict>
</plist>
3 changes: 1 addition & 2 deletions PhoneNumberKitTests/PartialFormatterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ class PartialFormatterTests: XCTestCase {
func testUSTollFreeNumber() {
let partialFormatter = PartialFormatter(region: "US")
var testNumber = "8"
print(partialFormatter.formatPartial("800253000"), "(800) 253-000")
XCTAssertEqual(partialFormatter.formatPartial(testNumber), "8")
testNumber = "80"
XCTAssertEqual(partialFormatter.formatPartial(testNumber), "80")
Expand All @@ -221,6 +220,6 @@ class PartialFormatterTests: XCTestCase {
testNumber = "8002530000"
XCTAssertEqual(partialFormatter.formatPartial(testNumber), "(800) 253-0000")
}

}

13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Inspired by Google's libphonenumber.

| Remaining Objectives
--- | ---
📝 | AsYouType formatter for UITextField.
⚔ | Battle-test PhoneNumberKit in a major app (100k+ users).

## Features
Expand All @@ -24,6 +23,7 @@ Inspired by Google's libphonenumber.
:books: | Best-in-class metadata from Google's libPhoneNumber project.
:trophy: | Fully tested to match the accuracy of Google's JavaScript implementation of libPhoneNumber.
:iphone: | Built for iOS. Automatically grabs the default region code from the phone.
📝 | Editable (!) AsYouType formatter for UITextField.
:us: | Convert country codes to country names and vice versa

## Usage
Expand Down Expand Up @@ -52,6 +52,15 @@ let phoneNumbers = PhoneNumberKit().parseMultiple(rawNumberArray)
let phoneNumbersCustomDefaultRegion = PhoneNumberKit().parseMultiple(rawNumberArray, region: "DE")
```

To use the AsYouTypeFormatter, just replace your UITextField with a PhoneNumberTextField.

PhoneNumberTextField automatically formats phone numbers and gives the user full editing capabilities. If you want to customize you can use the PartialFormatter directly. The default region code is automatically computed but can be overridden if needed.
```swift
let textField = PhoneNumberTextField()

PartialFormatter().formatPartial("+336895555") // +33 6 89 55 55
```

You can also query countries for a dialing code or the dailing code for a given country
```swift
let phoneNumberKit = PhoneNumberKit()
Expand Down Expand Up @@ -95,5 +104,5 @@ github "marmelroy/PhoneNumberKit"
### Setting up with [CocoaPods](http://cocoapods.org/?q=PhoneNumberKit)
```ruby
source 'https://github.com/CocoaPods/Specs.git'
pod 'PhoneNumberKit', '~> 0.3'
pod 'PhoneNumberKit', '~> 0.6'
```
2 changes: 2 additions & 0 deletions examples/AsYouType/Sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class ViewController: UIViewController, CNContactPickerDelegate {
super.viewDidLoad()
textField.region = "FR"
textField.becomeFirstResponder()
let text = PartialFormatter().formatPartial("+336895555")
print(text)
}

}
Expand Down

0 comments on commit 9fc5e71

Please sign in to comment.