https://github.com/gitobi/instagramer
Instagram API wrapper
https://github.com/gitobi/instagramer
Last synced: 12 months ago
JSON representation
Instagram API wrapper
- Host: GitHub
- URL: https://github.com/gitobi/instagramer
- Owner: gitobi
- License: mit
- Created: 2015-03-21T06:33:26.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-04-10T14:36:08.000Z (almost 11 years ago)
- Last Synced: 2024-03-17T17:31:41.386Z (about 2 years ago)
- Language: Swift
- Homepage:
- Size: 211 KB
- Stars: 7
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Instagramer
Instagram API wrapper
## Installation
### [CocoaPods](http://cocoapods.org)
`Podfile`:
```ruby
use_frameworks!
pod 'Instagramer', :git => 'https://github.com/gitobi/Instagramer.git'
```
dependency [Alamofire](https://github.com/Alamofire/Alamofire) and [SwiftyJSON](https://github.com/SwiftyJSON/SwiftyJSON)
## Usage
`InstagramerDemo.swift`:
```swift
import Instagramer
public class InstagramerDemo {
class var sharedInstance : InstagramerDemo {
struct Static {
static let instance = InstagramerDemo()
}
return Static.instance
}
private init() { }
var _instagramer = Instagramer(clientId: /* your application's CLIENT_ID */)
func setup() {
var needCallbackURLHandle = _instagramer.oAuth(
"access_token_key"
, redirectURI: /* your application's REDIRECT_URI */
, permitted : { [weak self] in
NSLog("permited : \(self?._instagramer.oAuth.accessToken)")
}, denied : { [weak self] in
NSLog("denied : \(self?._instagramer.oAuth.errors)")
}
}
func oauthCallbackHandle(url: NSURL) -> Bool {
return _instagramer.oAuthHandle(url)
}
func mediaSearch() {
_instagramer.mediaSearch(lat: /* latitude */, lng: /* longitude */)
.progress { (bytesRead, totalBytesRead, totalBytesExpectedToRead) in
NSLog("\(bytesRead)")
}
.response() { (request, response, data, error) in
NSLog("\(request)")
}
.complete() { (models: [InstagramerMedia]) in
for model in models {
NSLog("\(models.images.thumbnail.url)")
}
}
```
`AppDelegate.swift`:
```swift
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return InstagramerDemo.sharedInstance.oauthCallbackHandle(url)
}
```