Latest 0.2.1
Homepage https://github.com/squiffy/AlienKit
License MIT
Platforms ios 8.0, requires ARC
Dependencies Alamofire, SwiftyJSON, p2.OAuth2
Authors

CI Status
Version
License
Platform

Please note that this is still in development. Many, many endpoints are not implemented yet.
This library has no unit tests yet and some documentation is missing. Currently, AlienKit can only handle "app only" authorization. This means that you can access the Reddit API through oauth, just not in the context of a Reddit user. User-based authorization will be added eventually.

Usage

One of the goals of AlienKit is easy of use.

The first step to communicating with Reddit, is to obtain an app id. You can obtain one here.

Before you start using AlienKit, you must include the following line in all of the files you use AlienKit in:

import AlienKit

Once an app id has been obtained, you can use that app id to auth against oauth. To use "app only" authentication, you can use the following code. Be sure to use your own app id.

let client = UserlessClient(id: "my_app_id")

Now that you have a UserlessClient object, you can authorize with AlienKit:

client.authorize({
       print("Successfully authorized!")
   }, failure: { error in
       print("authorization failed: (error)")
})

Retrieve posts in a subreddit with sorting and filtering:

client.getPostsFrom("swift", sortFilter: (.Top, .Week), success: { listing in
        for thing in listing.things {
            if let link = thing as? Link {
                print(link.title)
            }
        }
    }, failure: {
        print("cant get posts")  
})

Retrieve the comment tree with sorting:

client.getCommentsFor(someLinkPost, sort: .Top, success: { listing in
        for thing in listing.things {
            if let comment = thing as? Comment {
                // replies are in comment.replies as a "Listing" object
                print(comment.body)
            }
        }
    }, failure: {
        print("cant get comments")    
})

Thats it for now! Come back later for more.

Installation

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

pod 'AlienKit'

Contributing

This project is being developed with a git workflow called gitflow. Therefore, when contributing, please work of the develop branch.

Author

@squiffy

License

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

Latest podspec

{
    "name": "AlienKit",
    "version": "0.2.1",
    "summary": "Swift API for Reddit",
    "description": "Heres a swift API for reddit. The few API wrappers thatnexist did not satisfy my needs. This is here to remedy that.",
    "homepage": "https://github.com/squiffy/AlienKit",
    "license": "MIT",
    "authors": {
        "squiffy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/squiffy/AlienKit.git",
        "tag": "0.2.1"
    },
    "social_media_url": "https://twitter.com/squiffy",
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "AlienKit": [
            "Pod/Assets/*.png"
        ]
    },
    "dependencies": {
        "Alamofire": [
            "~> 3.0"
        ],
        "SwiftyJSON": [
            "~> 2.3"
        ],
        "p2.OAuth2": [
            "~> 2.2.3"
        ]
    }
}

Pin It on Pinterest

Share This