Latest 0.1.4
Homepage https://github.com/23/VisualSwift
License MIT
Platforms ios 8.0, requires ARC
Dependencies Alamofire, IDZSwiftCommonCrypto
Authors

Version
License
Platform

Swift library for interfacing with the TwentyThree API.

Usage

After installation, import VisualSwift and init an API object with the domain and protocol of you TwentyThree account:

import VisualSwift

let visualAPI = VisualSwift(domain: "video.twentythree.net", scheme: "https")

If you need authorized access and have obtained the required API credentials, include these as a third argument when initializing the API object:

let credentials = [
    "consumer_key": "<consumer key>",
    "consumer_secret": "<consumer secret>",
    "access_token": "<access token>",
    "access_token_secret": "<access token secret>"
]
let visualAPI = VisualSwift(domain: "video.twentythree.net", scheme: "https", credentials: credentials)

Make requests

Now you’re ready to start making requests against the API by calling the request() method of your API object. Read the API documentation on https://www.twentythree.net/api to get a list of available endpoints.

// Simple request
visualAPI.request("/api/photo/list") {
    result in
    if result.isSuccess {
        print(result.value)
    }
}

// Request with parameters
let parameters = [
    "album_id": "123456"
]
visualAPI.request("/api/photo/list", parameters: parameters) {...}

// Specify request method
let method = "GET"
visualAPI.request("/api/photo/list", parameters: parameters, method: method) {...}

// Specify cache usage
let useCache = true
visualAPI.request("/api/photo/list", parameters: parameters, method: method, useCache: useCache) {...}

Upload videos

let parameters = [
    "title": "My new video"
]
let fileURL: NSURL = <NSURL object>
visualAPI.uploadFile("/api/photo/upload", parameters: parameters, fileURL: fileURL, progressCallback: {
    progress in
    dispatch_async(dispatch_get_main_queue(), {
        print(progress)
    })
}) {
    result in
    if result.isSuccess {
        print(result.value)
    }
}

Installation

CocoaPods

VisualSwift is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "VisualSwift"

Manual

Copy VisualSwift.swift and VisualSwiftUtils.swift from /Pod/Classes/ into your Xcode project.

Author

Kalle Kabell, [email protected]

License

VisualSwift is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "VisualSwift",
    "version": "0.1.4",
    "summary": "Swift library for interfacing with the TwentyThree API",
    "description": "Swift library for interfacing with the TwentyThree API.nProvides methods for anonymous or authenticated communication with endpoints.",
    "homepage": "https://github.com/23/VisualSwift",
    "license": "MIT",
    "authors": {
        "Kalle Kabell": "[email protected]"
    },
    "source": {
        "git": "https://github.com/23/VisualSwift.git",
        "tag": "0.1.4"
    },
    "social_media_url": "https://twitter.com/twentythree",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "dependencies": {
        "Alamofire": [
            "~> 3.0"
        ],
        "IDZSwiftCommonCrypto": [
            "~> 0.6.8"
        ]
    },
    "pushed_with_swift_version": "2.3"
}

Pin It on Pinterest

Share This