Simple and lightweight NSURLSession wrapper around Strava API.
When I first searched for any StravaAPI clients for iOS I found some old-fashioned obj-c like frameworks, but implemented in Swift, but not newer Swift. They were like Swift1 😔 They were old abandoned frameworks, so I decided to implement a newer Swift 4+ implementation.
Create and pass a valid config object to StravaAPIClient
and use the available methods to fetch anything from Strava API.
let config = StravaConfig(
clientId: Constants.clientId,
clientSecret: Constants.clientSecret,
redirectURL: Constants.redirectURL,
accessToken: Constants.accessToken
)
let client = StravaAPIClient(with: config)
// get current auth'd athlete
self.client.requestCurrentAthlete { result in
if case let .success(athlete) = result {
// use athlete
}
}
// or get activities
self.client.requestCurrentAthleteActivities { result in
if case let .success(activities) = result {
// use list of activities
}
}
This is still a WIP, but I'm adding new requests. Feel free to contribute with some more.
- Returns the authenticated athlete, retrieving an
Athlete
object
- Returns the authenticated athlete's activity summaries, retrieving an
SummaryActivity
list
- Returns the target athlete's stats, retrieving an
AthleteStats
object
Please check TODO.md doc