WaypointList
@IBDesignable
open class WaypointList : UITableView
Displays a list of scrollable WaypointItem objects containing a WaypointEntry
and provides the WaypointListDelegate protocol to get notified in case of user interaction.
It allows users drag items via a drag button and delete items via a delete button. By default, a
newly created WaypointList object has two empty WaypointEntry objects. Here, empty means
the WaypointEntry object has no coordinates and has a default name. In order to launch a
WaypointList object with a list of entries, its waypointEntries property may be set like
this:
waypointList.waypointEntries = [
WaypointEntry(...),
WaypointEntry(...),
WaypointEntry(...)
]
-
A string representation of the list which is useful for debugging.
Declaration
Swift
override open var description: String { get } -
Creates and returns a natural content size based on the related view properties.
Declaration
Swift
override open var intrinsicContentSize: CGSize { get } -
The minimum number of waypoints required for a route. When this value is set to a number lower than 2 or greater than entryCount, it will be reverted to its previous value.
Declaration
Swift
@IBInspectable public var minWaypointItems: Int { get set } -
The maximum number of waypoints. When this value is set to a number lower than minWaypointItems or maxVisibleItems or entryCount, it will be reverted to its previous value.
Declaration
Swift
@IBInspectable public var maxWaypointItems: Int { get set } -
The maximum number of waypoints this list should show at once. Any item above this number will be visible via scrolling. When this value is set to a number lower than the minWaypointItems or greater than maxWaypointItems, it will be reverted to its previous value.
Declaration
Swift
@IBInspectable public var maxVisibleItems: Int { get set } -
Number of
WaypointEntryobjects in the list.Declaration
Swift
public var entryCount: Int { get } -
A Boolean value indicating if it is possible to calculate a route. True, if the entries are valid and the minimum number of entries is available, false otherwise.
Declaration
Swift
public var isRoutingPossible: Bool { get } -
Array of
WaypointEntryobjects found in the list.Note
The array is initalized with minWaypointItemsWaypointEntryobjects having no coordinates.Note
When set to an array with less entries than minWaypointItems, it will be reverted to the old value.Note
When set to an array with more entries than maxWaypointItems, it will be reverted to the old value.Declaration
Swift
public var waypointEntries: [WaypointEntry] { get set } -
The array of all the
NMAWaypointobjects.Declaration
Swift
public var waypoints: [NMAWaypoint] { get } -
The item color when selected. The default value is
UIColor.colorBackgroundDark.Declaration
Swift
public var itemFlashColor: UIColor { get set } -
The duration, in seconds, the item stays selected before running its action. The default value is 0.015.
Declaration
Swift
public var itemFlashDuration: TimeInterval { get set } -
The item background color. The default value is
UIColor.colorBackgroundDark.Declaration
Swift
public var itemBackgroundColor: UIColor { get set } -
The item text color when address is available. The default value is
UIColor.colorForegroundLight.Declaration
Swift
public var itemTextColor: UIColor { get set } -
The item placeholder color. The default value is
UIColor.colorHintLight.Declaration
Swift
public var itemPlaceholderColor: UIColor { get set } -
The item text leading inset, which sets the spacing between the ‘remove’ button and the label. When the remove button is not displayed, increasing this inset may prove to be useful. The default value is 5.0.
Declaration
Swift
public var itemTextLeadingInset: CGFloat { get set } -
The item ‘remove’ button’s background color. The default value is
nil.Declaration
Swift
public var itemButtonBackgroundColor: UIColor? { get set } -
The item buttons’ - remove and reorder - tint color. The default value is
UIColor.colorForegroundLight.Declaration
Swift
public var itemButtonsTintColor: UIColor { get set } -
The optional delegate object. When it is set, the delegate object is informed about the user interactions.
Declaration
Swift
public weak var listDelegate: WaypointListDelegate?
-
Removes all the existing entries and restores the default state.
Declaration
Swift
public func reset() -
Reverses the order of the waypoint entries of this list. For example, if there are four entries, then 1, 2, 3, 4 will be reversed to 4, 3, 2, 1.
Declaration
Swift
public func reverse() -
Swaps the specified entries.
Declaration
Swift
public func swap(firstIndex: Int, secondIndex: Int) -
Inserts a new
WaypointEntryobject to the end of the list if it is valid.Note
If the entry is not valid, nothing is done.Note
If the list already has the maxWaypointItems, nothing is done.Note
If the entry is valid, scrolls to the row.Note
If there is a delegate, its.waypointList(_:didAdd:at:)method is called.Declaration
Swift
public func addEntry(_ entry: WaypointEntry)Parameters
entryWaypointEntryobject to be added to list. -
Inserts a new
WaypointEntryobject at the specified position to the list if it is valid.Note
If the entry is not valid, nothing is done.Note
If the list already reached the maxWaypointItems, nothing is done.Note
If the entry is valid, scrolls to the row.Note
If there is a delegate, its.waypointList(_:didAdd:at:)method is called.Declaration
Swift
public func insertEntry(_ entry: WaypointEntry, at index: Int)Parameters
entryWaypointEntryobject to be added to list.indexThe position at which to insert the new entry. It must be a valid index within the list or equal to the list’s entryCount property.
-
Updates the
WaypointEntryobject found at the specified position if it is valid.Note
If the entry is not valid, nothing is done.Note
If the entry is valid, scrolls to the row.Note
If there is a delegate, its.waypointList(_:didUpdate:at:)method is called.Declaration
Swift
public func updateEntry(_ entry: WaypointEntry, at index: Int)Parameters
entryWaypointEntryobject to be added to the list.indexThe position of the entry to update.
indexmust be a valid index within the list. -
Adds a
WaypointEntryobject with an emptyNMAWaypointobject using default values (latitude and longititude are zero and a default name) at the end of the list.Note
If there is a delegate, its.waypointList(_:didAdd:at:)method is called.Declaration
Swift
public func addEmptyEntry() -
Inserts a WaypointEntry
object with an emptyNMAWaypoint` object using default values (latitude and longititude are zero and a default name) at the specified position of the list.Note
If the entry is not valid, nothing is done.Note
If there is a delegate, its.waypointList(_:didAdd:at:)method is called.Declaration
Swift
public func insertEmptyEntry(at index: Int)Parameters
indexThe position at which to insert the new entry. It must be a valid index within the list or equal to the list’s entryCount property.
-
Removes and returns the entry at the specified position.
Note
If the list contains only the minWaypointItems, nothing is done.Note
If there is a delegate, its.waypointList(_:didRemove:at:)method is called.Note
If the entry is deleted, scrolls to the previous row.Declaration
Swift
@discardableResult public func removeEntry(at index: Int) -> WaypointEntry?Parameters
indexThe position of the entry to remove.
indexmust be a valid index within the list.Return Value
The entry at the specified index or nil if the index is not valid.
View on GitHub
WaypointList Class Reference