diff --git a/README.md b/README.md index fa832c7..5baef71 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,8 @@ - + +

@@ -279,6 +280,40 @@ github "WeTransfer/Mocker" ~> 1.00 Run `carthage update` to build the framework and drag the built `Mocker.framework` into your Xcode project. +### Swift Package Manager + +The [Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies. + +#### Manifest File + +Add Mocker as a package to your `Package.swift` file and then specify it as a dependency of the Target in which you wish to use it. + +```swift +import PackageDescription + +let package = Package( + name: "MyProject", + platforms: [ + .macOS(.v10_15) + ], + dependencies: [ + .package(url: "https://github.com/WeTransfer/Mocker.git", .upToNextMajor(from: "2.1.0")) + ], + targets: [ + .target( + name: "MyProject", + dependencies: ["Mocker"]), + .testTarget( + name: "MyProjectTests", + dependencies: ["MyProject"]), + ] +) +``` + +#### Xcode + +To add Mocker as a [dependency](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app) to your Xcode project, select *File > Swift Packages > Add Package Dependency* and enter the repository URL. + ### Manually If you prefer not to use any of the aforementioned dependency managers, you can integrate Mocker into your project manually.