- Welcome
- Getting started
- Latest updates
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria live
- Autosuggest
- Badge
- Banner alert
- Bar chart
- Blockquote
- Bottom navigation
- Bottom sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card List
- Card button
- Carousel
- Checkbox
- Chip
- Chip group
- Code
- Content cards
- Data Table
- Datepicker
- Description list
- Dialog
- Divider
- Drawer
- Field Set
- Flare
- Flat list
- Flight leg
- Floating action button
- Floating notification
- Form label
- Form validation
- Graphic promotion
- Horizontal navigation
- Icon
- Image
- Infinite scroll
- Link
- List
- Map
- Mobile scroll container
- Modal
- Navigation bar
- Nudger
- Overlay
- Page indicator
- Pagination
- Panel
- Phone input
- Picker
- Popover
- Price
- Progress bar
- Radio button
- Rating
- Scrollable calendar
- Section header
- Section list
- Select
- Skeleton
- Skip link
- Slider
- Snackbar
- Snippet
- Spinner
- Split input
- Star rating
- Switch
- Table
- Text
- Text input
- Theming
- Ticket
- Toast
- Tooltip
- Touchable native feedback
- Touchable overlay
- Content
- Accessibility
Flight leg
This component is for details of a flight journey from an origin to final destination.
Backpack/Flight Leg
Default
Day | Night |
---|---|
![]() |
![]() |
Usage
The BPKFlightLeg component contains nine properties, from which five are mandatory.
departureArrivalTime: String,
nextDayArrival: String?,
flightDescription: NSAttributedString,
stopsInfo: String,
highlightStopsInfo: Bool,
duration: String,
operatedBy: String?,
warning: String?,
carrierLogo: BPKIconName
- departureArrivalTime, nextDayArrival, stopsInfo, duration, operatedBy, warning expect Strings;
- flightDescription expects an attributed string;
- highlightStopsInfo expects a boolean;
- carrierLogo expects a BPKIconName.
If a flight has more than one leg (i.e. 1 or more stops), then highlightStopsInfo must be included and be set to true.
BPKFlightLeg Example
import Backpack
private let defaultDescription: NSAttributedString = {
return NSAttributedString(string: "EDI-LHR, British Airways", attributes: BPKFlightLeg.descriptionDefaultAttributes())
}()
private let highlightedDescription: NSAttributedString = {
let flightDescriptionString = NSMutableAttributedString(
string: "LHR-SYD, Emirates", attributes: BPKFlightLeg.descriptionDefaultAttributes())
let range = (flightDescriptionString.string as NSString).range(of: "SYD")
flightDescriptionString.addAttributes(BPKFlightLeg.airportHighlightAttributes(), range: range)
return flightDescriptionString
}()
let flightLegComponent = BPKFlightLeg(
departureArrivalTime: "17:25 - 19:00",
flightDescription: defaultDescription,
stopsInfo: "Direct",
duration: "1h 35m",
carrierLogo: .airline
)
let completeFlightLegWithAllPossibleArguments = BPKFlightLeg(
departureArrivalTime: "22:10 - 08:45",
nextDayArrival: "+2",
flightDescription: highlightedDescription,
stopsInfo: "1 Stop",
highlightStopsInfo: true,
duration: "25h 35m",
operatedBy: "Operated by Emirates",
warning: "Change airports in Dubai",
carrierLogo: .airline
)
Made with ❤️ by Skyscanner © 2023
© 2023 Skyscanner Backpack. Page last updated on Mar 31, 2023, 10:10