Install the iOS SDK
Install the iOS SDK
With an iOS application in place, you will need to import the required Box iOS SDK dependencies into your project using one of the available package manager options.
Select a package manager to use
Carthage
Carthage is a decentralized dependency manager for Swift and Objective-C Cocoa projects. It is open-source and built with Swift.
CocoaPods
CocoaPods is a centralized dependency manager for Swift and Objective-C Cocoa projects. It is open-source and was built with Ruby.
Swift Package Manager
The Swift Package Manager is a tool for managing the distribution of source code, making it easy to share your code and reuse others’ code.
Install the iOS SDK using Carthage
- From a terminal window, install Carthage:
brew install carthage
. Visit the Carthage documentation for other installation methods. - At the root of your iOS application folder, where the
{APPNAME}.xcodeproj
is located, create a new file namedCartfile
, without an extension. - Open the
Cartfile
and add the Box iOS SDK dependency withgit "https://github.com/box/box-ios-sdk.git" ~> 3.0
, then save and close the file. - From the terminal, in the folder where the
Cartfile
is present, update all dependencies:carthage update --platform iOS
. ACartfile.resolved
file and aCarthage
directory will be created in the directory. - Within a Finder or File Explorer window load the Carthage -> Build
-> iOS directory. This should have a framework file named
BoxSDK.framework
. Keep this window open as we'll use it to add the framework to our project in the next step. - In your Xcode project, click on the name of your application at the top of the project navigator on the left. In the content that displays, click on the name of your project under the TARGETS option. Scroll down to Frameworks, Libraries, and Embedded Content.
- Drag
BoxSDK.framework
from our Finder window over to the frameworks section.
Install the iOS SDK using CocoaPods
- From a terminal window, install CocoaPods:
sudo gem install cocoapods
. - At the root of your iOS application folder, where the
APPNAME.xcodeproj
is located, runpod init
to create a newPodfile
with smart defaults. - Load
Podfile
, add the Box iOS SDK dependency under# Pods for {APPNAME}
withpod 'BoxSDK', '~> 3.0'
, then save and close. - From the terminal, in the folder where the
Podfile
is present, download all dependencies:pod install
. - Open
.xcworkspace
in Xcode:open {APPNAME}.xcworkspace
and build the project.
Install the iOS SDK using the Swift Package Manager
- In your Xcode project, click on the name of your application at the top of the project navigator on the left. In the content that displays, click on the name of your project under the PROJECT option.
- Click on Swift Packages and click on the
+
to add a package. - Enter the following repository URL
https://github.com/box/box-ios-sdk.git
and click next. - Leave the default settings and click next to finish importing.
Summary
-
You either selected to install the iOS dependencies using Carthage
- You installed Carthage
- You create a
Cartfile
with the Box iOS SDK dependency - You installed the iOS SDK dependencies
- You manually imported the built dependencies into the Xcode project framework list.
-
Or selected to use CocoaPods and
- You installed CocoaPods
- You created a new
Podfile
with the Box iOS SDK dependency - You installed the iOS SDK dependencies
- You built the project in Xcode
-
Or selected to use the Swift Package Manager and
- You imported the iOS SDK
.git
repository into the Swift packages
- You imported the iOS SDK