PropertyList
open class PropertyList : ListBase, Sequence, @unchecked Sendable
A list of item type Property.
-
Undocumented
Declaration
Swift
public subscript(index: Int) -> Property { get set } -
An immutable empty
PropertyList.Declaration
Swift
public static let empty: PropertyList -
Construct a new list with
lengthof zero and optional initialcapacity. A list can expand in length beyond its initial capacity, but best performance will be obtained if the initial capacity is close to (and not less than) the list’s maximum length.Declaration
Swift
override public init(capacity: Int = (4 as Int))Parameters
capacityOptional initial capacity.
-
Add
itemto the end of this list.Declaration
Swift
public final func append(_ item: Property)Parameters
itemItem to be added.
-
Add all the items of
listto the end of this list.Declaration
Swift
public final func append(contentsOf list: PropertyList)Parameters
listItems to be added.
-
An ordering function for the item type of this list.
Declaration
Swift
override open var comparer: Comparer { get } -
Declaration
Swift
public final func copy() -> PropertyListReturn Value
A shallow copy of this list.
-
An equality function for the item type of this list.
Declaration
Swift
override open var equality: Equality { get } -
Declaration
Swift
public final func filter(_ predicate: @escaping (Property) -> Bool) -> PropertyListParameters
predicateFunction to be applied to each item of this list. Items matching this predicate will be returned in the new list.
Return Value
A new list which contains the items of this list that match a specified predicate function. Ordering is preserved.
-
Throws
EmptyListExceptionif the list is empty.Declaration
Swift
public final func first() -> PropertyReturn Value
The first item in this list.
-
Convert array to list.
Declaration
Swift
open class func fromArray(_ array: Array<Property>) -> PropertyListParameters
arrayArray with source items.
Return Value
New list with items copied from
arrayparameter. -
Declaration
Swift
public final func indexOf(item: Property, start: Int = (0 as Int)) -> IntParameters
itemstartZero-based starting index (search moves forwards from this index).
Return Value
First index in this list of
item, or-1if not found. -
Insert
iteminto this list, before the item (if any) atindex.Throws
ListIndexExceptionifindexis out of range (0 tolength).Declaration
Swift
public final func insert(at index: Int, item: Property)Parameters
indexZero-based index.
itemItem to be added.
-
Insert all items of
listinto this list, before the item (if any) atindex.Throws
ListIndexExceptionifindexis out of range (0 tolength).Declaration
Swift
public final func insert(at index: Int, contentsOf list: PropertyList)Parameters
indexZero-based index.
listList of items to be inserted.
-
Throws
ListIndexExceptionifindexis out of range (0 tolength- 1).Declaration
Swift
public final func item(at index: Int) -> PropertyParameters
indexZero-based index.
Return Value
The item in this list at the specified
index. -
Throws
EmptyListExceptionif the list is empty.Declaration
Swift
public final func last() -> PropertyReturn Value
The last item in this list.
-
Declaration
Swift
public final func lastIndexOf(item: Property, start: Int = (2147483647 as Int)) -> IntParameters
itemstartZero-based starting index (search moves backwards from this index).
Return Value
Last index in this list of
item, or-1if not found. -
Declaration
Swift
open func makeIterator() -> IndexingIterator<Array<Property>>Return Value
This list converted to a Swift iterator.
-
See also
copy,reverse.Declaration
Swift
open func reversed() -> PropertyListReturn Value
a reversed copy of this list.
-
Return a new
PropertyListthat shares theListBase.untypedListas thelistparameter. To ensure type safety, items inlistthat do not have the item typePropertywill be removed.Declaration
Swift
open class func share(_ list: ListBase) -> PropertyListParameters
listList whose items will be shared by the resulting list.
Return Value
A new list of item type
Property, sharing the same items aslist. -
Throws
EmptyListExceptionif the list has no items,NotUniqueExceptionif the list has multiple items.Declaration
Swift
public final func single() -> PropertyReturn Value
A single item from this list.
-
Declaration
Swift
public final func slice(start: Int, end: Int = (2147483647 as Int)) -> PropertyListParameters
startZero-based starting index (inclusive), or negative for starting index relative to the end of this list.
endZero-based ending index (exclusive), or negative for ending index relative to the end of this list.
Return Value
A slice of this list from index
start(inclusive) to indexend(exclusive). -
Sort this list in place (stable sort, O(n log n) complexity).
See also
copy,sort.Parameters
increasingPredicate that returns
trueif its first argument should preceed its second argument in the desired ordering. -
See also
copy,sort.Declaration
Swift
public final func sorted() -> PropertyListReturn Value
a sorted copy of this list using this list’s default
comparerfor ordering (stable sort, O(n log n) complexity). -
See also
copy,sortBy.Declaration
Parameters
increasingPredicate that returns
trueif its first argument should preceed its second argument in the desired ordering.Return Value
a sorted copy of this list (stable sort, O(n log n) complexity).
-
Declaration
Swift
open func sortedByKind() throws -> PropertyListReturn Value
a copy of this list, sorted by key properties, non-key properties, extension properties, then relationship properties (then by name within each of these groupings).
-
Declaration
Swift
open func sortedByLine() throws -> PropertyListReturn Value
a copy of this list, sorted by
Property.sourceLine. -
Declaration
Swift
open func sortedByName() throws -> PropertyListReturn Value
a copy of this list, sorted by
Property.name. -
Declaration
Swift
open func toArray() -> Array<Property>Return Value
This list converted to a Swift array.
-
Declaration
Swift
open func toNameList() throws -> StringListReturn Value
A list with the
Property.namefor each property in this list. -
Declaration
Swift
open func toPropertyArray() throws -> PropertyArrayReturn Value
An equivalent fixed-length array of properties.
-
Declaration
Swift
open func toPropertyMap() throws -> PropertyMapReturn Value
The same properties, mapped by
Property.name. -
Set the item in this list at the specified
index.Declaration
Swift
public final func update(at index: Int, item: Property)Parameters
indexZero-based index.
itemItem value.