|
@@ -32,17 +32,74 @@ Alamofire is an HTTP networking library written in Swift, from the [creator](htt
|
|
|
|
|
|
|
|
## Installation
|
|
## Installation
|
|
|
|
|
|
|
|
-> For application targets that do not support embedded frameworks, such as iOS 7, Alamofire can be integrated by including the `Alamofire.swift` source file directly, wrapping the top-level types in `struct Alamofire` to simulate a namespace. Yes, this sucks.
|
|
|
|
|
|
|
+**Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks.**
|
|
|
|
|
|
|
|
-_Due to the current lack of [proper infrastructure](http://cocoapods.org) for Swift dependency management, using Alamofire in your project requires the following steps:_
|
|
|
|
|
|
|
+To use Alamofire with a project targeting iOS 7, you must include the `Alamofire.swift` source file directly in your project. See the ['Source File'](#source-file) section for instructions.
|
|
|
|
|
|
|
|
-1. Add Alamofire as a [submodule](http://git-scm.com/docs/git-submodule) by opening the Terminal, `cd`-ing into your top-level project directory, and entering the command `git submodule add https://github.com/Alamofire/Alamofire.git`
|
|
|
|
|
-2. Open the `Alamofire` folder, and drag `Alamofire.xcodeproj` into the file navigator of your app project.
|
|
|
|
|
-3. In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
|
|
|
|
|
-4. Ensure that the deployment target of Alamofire.framework matches that of the application target.
|
|
|
|
|
-5. In the tab bar at the top of that window, open the "Build Phases" panel.
|
|
|
|
|
-6. Expand the "Target Dependencies" group, and add `Alamofire.framework`.
|
|
|
|
|
-7. Click on the `+` button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `Alamofire.framework`.
|
|
|
|
|
|
|
+### CocoaPods
|
|
|
|
|
+
|
|
|
|
|
+[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects.
|
|
|
|
|
+
|
|
|
|
|
+CocoaPods 0.36 beta adds supports for Swift and embedded frameworks. You can install it with the following command:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+$ gem install cocoapods --pre
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:
|
|
|
|
|
+
|
|
|
|
|
+```ruby
|
|
|
|
|
+source 'https://github.com/CocoaPods/Specs.git'
|
|
|
|
|
+platform :ios, '8.0'
|
|
|
|
|
+
|
|
|
|
|
+pod 'Alamofire', ~> '1.1'
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+Then, run the following command:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+$ pod install
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Carthage
|
|
|
|
|
+
|
|
|
|
|
+Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
|
|
|
|
|
+
|
|
|
|
|
+You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+$ brew update
|
|
|
|
|
+$ brew install carthage
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:
|
|
|
|
|
+
|
|
|
|
|
+```ogdl
|
|
|
|
|
+github "Alamofire/Alamofire" >= 1.1
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+### Manually
|
|
|
|
|
+
|
|
|
|
|
+If you prefer not to use either of the aforementioned dependency managers, you can integrate Alamofire into your project manually.
|
|
|
|
|
+
|
|
|
|
|
+### Embedded Framework
|
|
|
|
|
+
|
|
|
|
|
+- Add Alamofire as a [submodule](http://git-scm.com/docs/git-submodule) by opening the Terminal, `cd`-ing into your top-level project directory, and entering the following command:
|
|
|
|
|
+
|
|
|
|
|
+```bash
|
|
|
|
|
+$ git submodule add https://github.com/Alamofire/Alamofire.git
|
|
|
|
|
+```
|
|
|
|
|
+
|
|
|
|
|
+- Open the `Alamofire` folder, and drag `Alamofire.xcodeproj` into the file navigator of your app project.
|
|
|
|
|
+- In Xcode, navigate to the target configuration window by clicking on the blue project icon, and selecting the application target under the "Targets" heading in the sidebar.
|
|
|
|
|
+- Ensure that the deployment target of Alamofire.framework matches that of the application target.
|
|
|
|
|
+- In the tab bar at the top of that window, open the "Build Phases" panel.
|
|
|
|
|
+- Expand the "Target Dependencies" group, and add `Alamofire.framework`.
|
|
|
|
|
+- Click on the `+` button at the top left of the panel and select "New Copy Files Phase". Rename this new phase to "Copy Frameworks", set the "Destination" to "Frameworks", and add `Alamofire.framework`.
|
|
|
|
|
+
|
|
|
|
|
+#### Source File
|
|
|
|
|
+
|
|
|
|
|
+For application targets that do not support embedded frameworks, such as iOS 7, Alamofire can be integrated by adding the `Alamofire.swift` source file directly into your project. Note that any calling conventions described in the ['Usage'](#usage) section with the `Alamofire` prefix would instead omit it (for example, `Alamofire.request` becomes `request`), since this functionality is incorporated into the top-level namespace.
|
|
|
|
|
|
|
|
---
|
|
---
|
|
|
|
|
|