Latest 0.1.3
License MIT
Platforms ios 8.0

GoBus: Elegant way to get data from Inthegra API in Swift.

Build status
Platform iOSSwift 2 compatible
CocoaPods compatible
License: MIT


GoBus! is a library to help developers to interact with Inthegra API in Swift. We provide an easy way to get data and some new features not implemented on api.


  • iOS 8.0+
  • Xcode 7.3+

Getting involved

  • If you want to contribute please feel free to submit pull requests.
  • If you have a feature request please open an issue.
  • If you found a bug check older issues before submitting an issue.


Follow these 3 steps to run Example project: Clone GoBus repository, open Example workspace and run the Example project.


Set Auth Token

It is quite simple to set auth token, just like this:

import UIKit
import GoBus

class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        // Override point for customization after application launch.

        GoBus().setupWithApiKey(apiKey: String, email: String, password: String, url: String)
        return true

In this example we just set your application key, email and password. With this, you will automatically logged and the access token retrieved and updated automatically.

Now you are read to use GoBus funcs.

How to get bus values

We can get bus values by invoking the following three GoBus function:

Get All Bus

GoBus().getBus(completion: (([Bus]?, [Line]?, NSError?) -> Void))

GoBus().getBus() { (buss, lines, error) in
    if error != nil {
    }else {
        if lines != nil {
            for line in lines! {

        if buss != nil {
            for bus in buss! {

Will return an array with Bus objects, an array with Line objects and an NSError

All Bus of specific line

GoBus().getBus(inLine: String?, completion: (([Bus]?, [Line]?, NSError?) -> Void))

GoBus().getBus(inLine: "0408") { (buss, line, error) in
    if error != nil {
    }else {
        if line != nil {
            //We received only one Line, which correspond to the line researched

        // - buss - correspond to all Bus in the line researched
        if buss != nil {
            for bus in buss! {

Pass the number of the line you want to return and will receive an array with Bus objects of this line, an array with the Line and an NSError

Use GoBus().getBus PROTOCOL

//** repeatAfter works in Seconds
GoBus().getBus(inLine: String?, repeatAfter: Double?, completion: (([Bus]?, [Line]?, NSError?) -> Void))


//  1: GoBus().getBus(inLine: "0408", repeatAfter: 30, completion: (([Bus]?, [Line]?, NSError?) -> Void)) with Search
//  2: GoBus().getBus(repeatAfter: 30, completion: (([Bus]?, [Line]?, NSError?) -> Void)) without Search

//  3: In this case, you can use either the first way as the second

// - First, add GoBusDelegate in the class

let go = GoBus()
//Returns both the bus as the line now. From now on, every five seconds the function implemented by the protocol will return updated values.
let cancel = go.getBus(inLine: "0408", repeatAfter: 5) { (buss, line, error) in }

//Using this way (3), now you can cancel repeat After and the call protocol

See more like how get Line and Stops in Example Project



CocoaPods is a dependency manager for Cocoa projects.

Specify GoBus into your project’s Podfile:

source ''
platform :ios, '8.0'

pod 'GoBus'

Then run the following command:

$ pod install

To-Do List

  • [ ] Add ability to stop being sought by lines
  • [ ] Improve Documentation


Orlando Amorim, [email protected]


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

Latest podspec

    "name": "GoBus",
    "version": "0.1.3",
    "summary": "Elegant way to get data from Inthegra API.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Orlando Amorim": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.3"
    "social_media_url": "",
    "ios": {
        "frameworks": [
    "platforms": {
        "ios": "8.0"
    "source_files": "GoBus/Classes/**/*.swift"

Pin It on Pinterest

Share This