Latest 2.0.2
Homepage https://github.com/AnatoliyGatt/QuotzzyKit
License MIT
Platforms osx 10.10, ios 8.0, watchos 2.0, tvos 9.0, requires ARC
Authors

QuotzzyKit Logo

CocoaPods Pod Version
CocoaPods Pod License
CocoaPods Pod Platform
CocoaPods Pod Language
Carthage Compatible
Travis CI Build Status
CODEBEAT Status
Codecov Test Coverage Status

An elegant client for Quotzzy API written in Swift.

Requirements

  • macOS 10.10+
  • iOS 8.0+
  • watchOS 2.0+
  • tvOS 9.0+
  • Swift 2.1+
  • Xcode 7.1+

Installation

Embedded frameworks require a minimum deployment target of iOS 8 or macOS 10.10.

CocoaPods

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

$ gem install cocoapods

CocoaPods 0.39+ is required to build QuotzzyKit.

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

source "https://github.com/CocoaPods/Specs.git"
platform :ios, "8.0"
use_frameworks!

target "<Your Target Name>" do
    pod "QuotzzyKit", "~> 2.0.2"
end

Then, run the following command:

$ pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate QuotzzyKit into your Xcode project using Carthage, specify it in your Cartfile:

github "AnatoliyGatt/QuotzzyKit" ~> 2.0.2

Run carthage update to build the framework and drag the built QuotzzyKit.framework into your Xcode project.

Quick Start

The quickest way to get started is by executing following code:

import QuotzzyKit

Quotzzy.sharedClient().getQuote(.English, key: nil, completionHandler: { (quote: Quote?, error: NSError?) -> Void in
    if error == nil {
        print("(quote?.text) - (quote?.author?.name)((quote?.author?.wiki))")
    }
})

If everything went well, you’ll see something like this in your console:

Ignorance never settle a question. - Benjamin Disraeli(http://en.wikipedia.com/wiki/Benjamin%20Disraeli)

Documentation

sharedClient()

Get singleton instance of Quotzzy.

Example

Quotzzy.sharedClient()

getQuote(lang: Language?, key: Int?, completionHandler: (quote: Quote?, error: NSError?) -> Void)

Requests random quote.

Parameters

  • lang – Response language (.English or .Russian).
  • key – Numeric key, which influences the choice of quotation, the maximum length is 6 digits.
  • completionHandler – Callback when response comes in.

Completion Handler Properties

Quote

Used to represent quote object.

Properties
  • text – Quote’s text.
  • author – Quote’s author.
    • name – Author’s name.
    • wiki – Author’s wiki URL.
Error

When error occur, you receive an NSError object as a second argument of the completion handler.

Examples

Requests quote in default language (English) without manually set key.

Quotzzy.sharedClient().getQuote(nil, key: nil, completionHandler: { (quote: Quote?, error: NSError?) -> Void in
    if error == nil {
        print("(quote?.text) - (quote?.author?.name)((quote?.author?.wiki))")
    }
})

Requests quote in Russian with manually set key.

Quotzzy.sharedClient().getQuote(.Russian, key: 123456, completionHandler: { (quote: Quote?, error: NSError?) -> Void in
    if error == nil {
        print("(quote?.text) - (quote?.author?.name)((quote?.author?.wiki))")
    }
})

License

Distributed under the MIT License.

Latest podspec

{
    "name": "QuotzzyKit",
    "version": "2.0.2",
    "summary": "An elegant client for Quotzzy API written in Swift.",
    "homepage": "https://github.com/AnatoliyGatt/QuotzzyKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Anatoliy Gatt": "[email protected]"
    },
    "platforms": {
        "osx": "10.10",
        "ios": "8.0",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/AnatoliyGatt/QuotzzyKit.git",
        "tag": "v2.0.2"
    },
    "source_files": "Sources/*.swift",
    "requires_arc": true,
    "cocoapods_version": ">= 0.39"
}

Pin It on Pinterest

Share This