Skip to content

Commit

Permalink
Add SPM_README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonjenniges committed Mar 28, 2023
1 parent 36284c8 commit fa3e366
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 20 deletions.
22 changes: 2 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,10 @@ Make sure the above run script is below any `[CP] Embed Pods Frameworks` or `Emb

## Swift Package Manager

[Swift Package Manager](https://www.swift.org/package-manager/) support is available for Swift 5.3 and above but is currently not the recommended method for adding the Square In-App Payments SDK dependency.
[Swift Package Manager](https://www.swift.org/package-manager/) support is available for Swift 5.3 and above but is currently **not** the recommended method for adding the Square In-App Payments SDK dependency.

### 1. Add the following to your top-level `dependencies` block within your `Package.swift`:
Setup instructions can be found [here](SPM_README.md).

```swift
dependencies: [
.package(url: "https://github.com/square/in-app-payments-ios", .upToNextMajor(from: "1.6.1")),
]
```

### 2. Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework ###

On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

```
SETUP_SCRIPT="${CONFIGURATION_BUILD_DIR}/SquareInAppPaymentsSDK.framework/setup"
if [ -f "$SETUP_SCRIPT" ]; then
"$SETUP_SCRIPT"
fi
```

**Important Note:** The build phase script requires you to reset your Swift Package Caches when switching from a debug build to a release build (archiving) or vice versa. This helps prevent errors during building or releasing. You can reset your cache by using `File -> Packages -> Reset Package Caches` in Xcode.

### iPhone and iPad apps on Mac with Apple silicon

Expand Down
22 changes: 22 additions & 0 deletions SPM_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Swift Package Manager

### 1. Add the following to your top-level `dependencies` block within your `Package.swift`:

```swift
dependencies: [
.package(url: "https://github.com/square/in-app-payments-ios", .upToNextMajor(from: "1.6.1")),
]
```

### 2. Add build phase to setup the SquareInAppPaymentsSDK and/or SquareBuyerVerificationSDK framework ###

On your application targets’ Build Phases settings tab, click the + icon and choose New Run Script Phase. Create a Run Script in which you specify your shell (ex: /bin/sh), add the following contents to the script area below the shell:

```
SETUP_SCRIPT="${CONFIGURATION_BUILD_DIR}/SquareInAppPaymentsSDK.framework/setup"
if [ -f "$SETUP_SCRIPT" ]; then
"$SETUP_SCRIPT"
fi
```

**Important Note:** The build phase script requires you to reset your Swift Package Caches when switching from a debug build to a release build (archiving) or vice versa. This helps prevent errors during building or releasing. You can reset your cache by using `File -> Packages -> Reset Package Caches` in Xcode.

0 comments on commit fa3e366

Please sign in to comment.