Latest 0.1.1
Homepage https://github.com/omaralbeik/UDClient
License MIT
Platforms ios 9.0, requires ARC
Dependencies AlamofireObjectMapper, GraphQLicious, JWTDecode, SwiftyJSON, SwifterSwift
Authors

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.

Latest podspec

{
    "name": "UDClient",
    "version": "0.1.1",
    "summary": "Super easy to use Udacity Auth and Classroom APIs client for iOS",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "homepage": "https://github.com/omaralbeik/UDClient",
    "authors": {
        "Omar Albeik": "[email protected]"
    },
    "social_media_url": "https://twitter.com/omaralbeik",
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": "true",
    "source": {
        "git": "https://github.com/omaralbeik/UDClient.git",
        "tag": "0.1.1"
    },
    "source_files": "Sources/**/*.swift",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "dependencies": {
        "AlamofireObjectMapper": [
            "~> 4.1"
        ],
        "GraphQLicious": [
            "~> 0.8"
        ],
        "JWTDecode": [
            "~> 2.0"
        ],
        "SwiftyJSON": [
            "~> 3.1"
        ],
        "SwifterSwift": [
            "~> 3.0"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This