Skip to content

Commit

Permalink
Update readme with SPM instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroyspotify committed Sep 20, 2020
1 parent 8bff096 commit dacede2
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,26 @@ You can access the metadata powering PhoneNumberKit yourself, this enables you t
phoneNumberKit.metadata(for: "AU")?.mobile?.exampleNumber // 412345678
```

### [Preferrred] Setting up with [Swift Package Manager](https://swiftpm.co/?query=PhoneNumberKit)

The [Swift Package Manager](https://swift.org/package-manager/) is now the preferred tool for distributing PhoneNumberKit.

From Xcode 11+ :

1. Select File > Swift Packages > Add Package Dependency. Enter `https://github.com/marmelroy/PhoneNumberKit.git` in the "Choose Package Repository" dialog.
2. In the next page, specify the version resolving rule as "Up to Next Major" with "3.3.0".
3. After Xcode checked out the source and resolving the version, you can choose the "PhoneNumberKit" library and add it to your app target.

For more info, read [Adding Package Dependencies to Your App](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) from Apple.

Alternatively, you can also add PhoneNumberKit to your `Package.swift` file:

```swift
dependencies: [
.package(url: "https://github.com/marmelroy/PhoneNumberKit", .upToNextMajor(from: "3.3.0"))
]
```

### Setting up with Carthage

[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
Expand All @@ -143,8 +163,3 @@ github "marmelroy/PhoneNumberKit"
source 'https://github.com/CocoaPods/Specs.git'
pod 'PhoneNumberKit', '~> 3.3'
```

### Setting up with [Swift Package Manager](https://swiftpm.co/?query=PhoneNumberKit)

As of swift 5.3, Swift Package Manager does support resources bundled with Swift packages.
Becuase of this, you no longer need to manually copy `PhoneNumberMetadata.json` into your project.

0 comments on commit dacede2

Please sign in to comment.