1. Adding the SDK to Your App
There are 3 ways to add the SDK to your app:
CocoaPods
You’ll know the SDK has been added to your app successfully when:
- A
Podfile.lock
file has been created in the project folder;- A file with the
.xcworkspace
extension has been created in the project folder;- A
Pods
widget containing aMindbox
folder has been created in thexCode Project
navigator.
To add Mindbox’s SDK to your app from Cocoapods, open the Podfile
in your app’s root directory and specify the required guide.
If the Podfile
is missing there, run pod init
from the project folder to initialize Cocoapods.
Next, add the dependency to your main app: target '<your app name>'
, making sure that the use_frameworks!
guide is at the beginning of the Podfile
.
We recommend that you specify the latest iOS SDK version published on Mindbox’s GitHub Releases.
use_frameworks!
...
target '<your app name>' do
...
pod 'Mindbox', '{latest release}'
# pod 'Mindbox', '2.1.5'
end
Run pod install
in the terminal.
Open a .xcworkspace
file in xCode.
Carthage
You’ll know the SDK has been added to your app successfully when a
Frameworks
folder withMindbox.xcframework
has been created in theXcode Project
navigator.
-
Make sure you’ve closed Xcode.
-
Using the terminal (
cd path/to/project
), go to your project’s folder. -
Run touch
Cartfile
to create aCartfile
. -
Enter
echo 'github "https://github.com/mindbox-cloud/ios-sdk.git"' → Cartfile
in yourCartfile
. -
Execute
carthage update --no-use-binaries --use-xcframeworks
:- For Xcode 11 or earlier, run
carthage update --no-use-binaries
. Note that all the .xcframework examples should have the .framework extension in the instruction.
- For Xcode 11 or earlier, run
-
Open your project in Xcode.
-
Select the main Target in the project settings. Open the "General" tab.
-
Drag your Mindbox.xcframework folder from
<YOUR PROJECT'S DIRECTORY>/Carthage/Build
to"Frameworks, Libraries, and Embedded Content"
. -
If you add the file using the "+" button, a window appears: select Create folder references and click Finish.
Swift package manager
You’ll know the SDK has been added to your app successfully when a Mindbox develop package has been created in Package Dependencies.
- Open the top menu in Xcode and go to
"File" → "Add Packages..."
. - Enter the link to Mindbox’s SDK:
https://github.com/mindbox-cloud/ios-sdk
. - Select a relevant release (1.3.3 supports Swift Package Manager) and click Add Package.
- Once the package has been downloaded, add
Mindbox
to the main project target.
Check your results:
Podfile.lock
has been created in the project folder;- A
.xcworkspace
file is created in the project folder, and- A
Pods
widget with aMindbox
folder is created in the xCode Project navigator.
Updated about 1 year ago