- Welcome
- Getting started
- Monthly update
- Foundations
-
Components
- Accordion
- Alert
- Alignment
- Aria Live
- Autosuggest
- Badge
- Banner Alert
- Bar Chart
- Blockquote
- Bottom Navigation
- Bottom Sheet
- Breadcrumb
- Breakpoint
- Button
- Calendar
- Card
- Card Button
- Carousel
- Checkbox
- Chip
- 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 List
- Select
- Skeleton
- Skip Link
- Slider
- Snackbar
- 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