The Strava V3 API is a publicly available interface allowing developers access to the rich Strava dataset.
This project is not official Strava library written in Swift. It supports read operations for all of the API endpoints and supports user activities upload.
- Features
- TODO
- Documentation
- Dependencies
- Requirements
- Communication
- Installation
- Usage
- FAQ
- Credits
- License
- 100% Strava API coverage
- Most of Strava objects are modelled and ready for convenient usage
- Networking is incapsulated and all heavy-Strava-lifting is done by the framework. So you can focus on your application functionality
- Better error handling
- Sample application
- 100% Documentation coverage
- Generate Documentation
- Unit Tests
- Multiple file/data uploading options
- Distribute via Cocoapods
StravaClient
have apple doc comments. You can check them in the code or using Xcode help hints (Alt + click on required method)
SwiftyStrava has three external dependencies:
- iOS 8.0+ / macOS 10.10+
- Xcode 8.1+
- Swift 3.0+
- If you need help, use Stack Overflow. (Tag 'swiftystrava')
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate SwiftyStrava into your Xcode project using Carthage, specify it in your Cartfile
:
github "tristanhimmelman/AlamofireObjectMapper"
github "Hearst-DD/ObjectMapper"
github "limlab/SwiftStravaSDK"
Run carthage update
to build the framework and drag the built Strava.framework
into your Xcode project.
CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects. CocoaPods is built with Ruby and is installable with the default Ruby available on OS X.
You can install CocoaPods using the following command:
$ sudo gem install cocoapods
Please refer to official guide for more installation instructions.
To integrate SwiftyStrava into your Xcode project using CocoaPods, put these lines into your Podfile
:
pod 'AlamofireObjectMapper', '~> 4.0'
pod 'SwiftyStrava', '~> 0.8'
Run pod install
to fetch dependencies.
- Read Strava API Docs (Authentication)
- Create your application account
2.1. Create or login to your Strava account
2.2. Create new application Using Strava Developers Page
2.3. Remember
ClientID
,Client Secret
- Create new Xcode project 3.1 Open Xcode 3.2 File -> New -> Project -> Single View Application -> Next 3.3 Select some cool name for your project, select Swift as main project language. (Why do you need SwiftyStrava otherwise? :)) 3.4
- Follow the Installation chapter
- Open your
AppDelegate
file
// Import framework
import Strava
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// ...
// Setup `StravaClient`
StravaClient.instance.configure(clientId: <#Your Client Id#> (as a UInt64), clientSecret: "<#Your Client Secret#>", callbackURL:"yourConfiguredCallbackURL")
//...
return true
}
In any other file where you wish to read some Strava data:
// Import framework
import Strava
// ...
func myAmazingFunction() {
StravaClient.instance.retrieveAthlete(athleteId: <#Some athletes id#>) { athleteResponse in
switch response {
case .Success(let athlete):
print("Hoorrray! Athlete data received")
print(athlete)
case .Failure(let err):
print("Ouch! Something wrong happened. Probably this: \(err.message)")
}
}
}
- Read Strava API Docs, because all the methods in the library are pretty much the same
- Do not hesistate to Communicate
SwiftyStrava is released under the MIT license. See LICENSE for details.