The Wayback Machine - https://web.archive.org/web/20220425151828/https://github.com/ManuelBulos/FlightTicketView
Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

FlightTicketView

Simple UIViewController containing a UITableView with custom Cells that resemble a flight ticket with holes and separator.

Screenshots

Requirements

  • iOS 10.2+
  • Xcode 9

Integration

CocoaPods (iOS 8+)

You can use CocoaPods to install FlightTicketView by adding it to your Podfile:

target 'MyApp' do
    pod 'FlightTicketView'
end

Deployment

Start by importing the framework to your project

import FlightTicketView

Subclass UITicketViewController and set the FlightTicketView container frame

class ViewController: UITicketViewController {
    override func viewDidLoad() {
    super.viewDidLoad()
    ticketViewContainer = self.view
    addTickets()
    }
}

Create addTickets() method and fill the tickets array

func addTickets() {
    // Create a stop over
    let stopOver = StopOver(id: 1,
    airlineName: "Aeromexico",
    airlineLogo: UIImage(named: "airlineExample1") ?? UIImage(),
    departureTime: Date(),
    arrivalTime: Date(),
    departureCity: "MEXICO",
    arrivalCity: "MADRID")

    // Create a flight ticket with the stop over
    // previously created
    let flightTicket = Ticket(id: 1,
    departureCityShort: "MEX",
    departureCityLong: "Cd. México",
    arrivalCityShort: "AMS",
    arrivalCityLong: "Amsterdam",
    stopOvers: [stopOver])

    // Fill array of tickets
    tickets = [flightTicket]
    ticketsTableView.reloadData()
}

That's it! you can add as many stop overs and tickets as you want. Don't forget to check out the demo project for more ideas.

License

This project is licensed under the MIT License - see the LICENSE.md file for details