Swift Shell Other
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Example
Pods
Sources
UDClient.xcodeproj
UDClient.xcworkspace
.gitignore
.swift-version
LICENSE
Podfile
Podfile.lock
README.md
UDClient.podspec

README.md

UDClient

Super easy to use Udacity Auth and Classroom APIs client for iOS

Swift Xcode MIT


⚠️ To use with Swift 3 / Xcode 8.x please ensure you are using v0.1.1.

⚠️ To use with Swift 4 / Xcode 9.x please ensure you are using v0.3.2


Usage

Get User's basic info, Courses, Nanodegrees, and much more with few lines of code

Get Access Token

UDClient.shared.requestToken(email: email, password: password) { error, token in
  if error != nil {
    // handle error
    return
  }

  // get token
  let token = token?.string

  // get token expiry date
  let expiryDate = token?.expiryDate

  // check if token is expired
  let isExpired = token?.isExpired

  // store the token.
}

Get User Info

// all user info
let fields: UDUser.allFields

// basic user info
let fields: [UDUser.fields] = [.id, .firstName, .lastName, .email]
// and more ..

// user Nanodegrees
let fields: [UDUser.fields] = [.nanodegrees(fields: [.title, .summary])]
// and more ..

// Nanodegree hero image
let fields: [UDUser.fields] = [.nanodegrees(fields: [.heroImage(fields: [.url])])]
// and more

UDClient.shared.fetchUserInfo(token: token, fields: fields) { error, user in
  if error != nil {
    // handle error
    return
  }

  // print user debug description for easy debugging
  print(user?.debugDescription)
  // do something else with user info
}

Structure

Model:

Services:

Udacity Classroom API:

Dependencies:

Requirements:

  • iOS 8+
  • Xcode 9+
  • Swift 4

Installation

CocoaPods

To integrate UDClient into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'UDClient'

Manually

Add the Sources folder to your Xcode project.

Don't forget to install dependencies from the Podfile

License

UDClient is released under the MIT license. See LICENSE for details.