Udacity Classroom API client for iOS
Swift Ruby Objective-C
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
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

Usage

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

Get Access Token

Fetch a story, comment, job, Ask HN, poll or poll part for a given id:

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

  // get token
  let token = jwtoken?.string

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

  // check if token is expirted
  let expired = jwtoken?.expired

  // store the token.
}

Get User Info

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

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

// Nanodegree hero image
let fields: [UDUserField] = [.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
}

Structure

Model:

Services:

Common:

Udacity Classroom API:

Dependencies:

Requirements:

  • iOS 9.0+
  • Xcode 8.1+
  • Swift 3.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

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

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'UDClient', :git => 'https://github.com/omaralbeik/UDClient.git'
end

Then, run the following command:

$ pod install

Manually

Add the Sources folder to your Xcode project.

Don't forget to add all dependencies from the Podfile

License

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