Skip to content

The official seats.io iOS library

License

Notifications You must be signed in to change notification settings

dicefm/seatsio-ios

 
 

Repository files navigation

Seatsio iOS SDK

Build Status

Introduction

seatsio-ios allows rendering seats.io seating charts inside an iOS application. It supports iOS 9.0 and newer.

Installation

Add this to your podfile:

pod 'seatsio', '14.4.0'

Usage

class SeatingChartSample: UIViewController {

    var seatsio: SeatsioWebView!

    override func loadView() {
        let config: SeatingChartConfig = SeatingChartConfig()
                .workspaceKey("<your public workspace key>")
                .event("<your event key>")

        seatsio = SeatsioWebView(frame: UIScreen.main.bounds, region: "eu", seatsioConfig: config)

        self.view = seatsio
    }

}

You can find the all the configuration options at https://docs.seats.io/docs/renderer-configure-your-floor-plan

Simple pricing

SeatingChartConfig()
    .pricing([
        Pricing(category: "1", price: 40),
        Pricing(category: "2", price: 50)
    ])
    .priceFormatter({ (price) in "\(price)$" })

Multi-level pricing

SeatingChartConfig()
    .pricing([
        Pricing(category: "1", ticketTypes: [
            TicketTypePricing(ticketType: "child", price: 10),
            TicketTypePricing(ticketType: "adult", price: 15)]),
        Pricing(category: "2", ticketTypes: [
            TicketTypePricing(ticketType: "child", price: 20),
            TicketTypePricing(ticketType: "adult", price: 30)])
    ])
    .priceFormatter({ (price) in "\(price)$" })

Creating a session to hold seats

var seatingChart: SeatingChart!

let config: SeatingChartConfig = SeatingChartConfig()
        .workspaceKey("<your public workspace key>")
        .event("<your event key>")
        .session("start")
        .onChartRendered({ (chart) in
            seatingChart = chart
        })

// after webview has rendered
seatingChart.getHoldtoken({ (token) in
    // do something with the token
})

onObjectSelected / onObjectDeselected

SeatingChartConfig()
    .onObjectSelected({ (object, ticketType) in
        print(object, ticketType)
    })
    .onObjectDeselected({ (object, ticketType) in
        print(object, ticketType)
    })

chart.listSelectedObjects

var seatingChart: SeatingChart!

let config: SeatingChartConfig = SeatingChartConfig()
    .workspaceKey("<your public workspace key>")
    .event("<your event key>")
    .onChartRendered({ (chart) in
        seatingChart = chart
    })

// after webview has rendered
seatingChart.listSelectedObjects({ (objects) in
    // do something with the objects
})

chart.getReportBySelectability

var seatingChart: SeatingChart!

let config: SeatingChartConfig = SeatingChartConfig()
    .workspaceKey("<your public workspace key>")
    .event("<your event key>")
    .onChartRendered({ (chart) in
        seatingChart = chart
    })

// after webview has rendered
seatingChart.getReportBySelectability({ (report) in
    // do something with the report
})

chart.zoomToSection

var seatingChart: SeatingChart!

let config: SeatingChartConfig = SeatingChartConfig()
    .workspaceKey("<your public workspace key>")
    .event("<your event key>")
    .onChartRendered({ (chart) in
        seatingChart = chart
    })

// after webview has rendered
seatingChart.zoomToSection(label: "<sectionLabel>")

Methods on seats (and other selectable objects)

var seatingChart: SeatingChart!

let config: SeatingChartConfig = SeatingChartConfig()
    .workspaceKey("<your public workspace key>")
    .event("<your event key>")
    .onChartRendered({ (chart) in
        chart.selectObject("K-3") // or chart.deselectObject("K-3")
        chart.pulseObject("K-3") // or chart.unpulseObject("K-3")
        chart.isObjectInChannel("K-3", "NO_CHANNEL", { (result) in print("Is object in channel NO_CHANNEL? " + String(result)) })
    })

About

The official seats.io iOS library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 95.4%
  • JavaScript 3.6%
  • Ruby 1.0%