CollectionOfOne

A collection containing a single element of type T.

Inheritance CollectionType, Reflectable, SequenceType, _CollectionType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types

A type that represents a valid position in the collection.

Valid indices consist of the position of every element and a "past the end" position that's not valid for use as a subscript.

Type alias inferred.

  • Element = T

Type alias inferred.

  • Index = Index

Type alias inferred.

Type alias inferred.

Import
  • import Swift

Initializers

init(_:)

Construct an instance containing just element.

Declaration

  • init(_ element: T)

Instance Variables

var endIndex: Index

The "past the end" position; always identical to startIndex.successor().

Note: endIndex is not a valid argument to subscript.

Declaration

  • var endIndex: Index { get }
var startIndex: Index

The position of the first element.

Declaration

  • var startIndex: Index { get }

Subscripts

subscript(_: Index)

Declaration

  • subscript(position: Index) -> T { get }

Instance Methods

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

func getMirror()

Returns a mirror that reflects self.

Declaration