Instance Propertyswift 6.0.3Swift
count
The number of elements in the collection, which is always one.
var count: Int { get }
The number of elements in the collection, which is always one.
var count: Int { get }
import Swift
@frozen struct CollectionOfOne<Element>
A collection containing a single element.
@frozen struct Int
A signed integer value type.
init(_ element: Element)
Creates an instance containing just the given element.
var customMirror: Mirror { get }
var debugDescription: String { get }
A textual representation of the collection, suitable for debugging.
var endIndex: CollectionOfOne<Element>.Index { get }
The “past the end” position—that is, the position one greater than the last valid subscript argument.
var startIndex: CollectionOfOne<Element>.Index { get }
The position of the first element.
subscript(bounds: Range<Int>) -> CollectionOfOne<Element>.SubSequence { get set }
subscript(position: Int) -> Element { get set }
Accesses the element at the specified position.
func index(after i: CollectionOfOne<Element>.Index) -> CollectionOfOne<Element>.Index
Returns the position immediately after the given index.
func index(before i: CollectionOfOne<Element>.Index) -> CollectionOfOne<Element>.Index
Returns the position immediately before the given index.
func makeIterator() -> CollectionOfOne<Element>.Iterator
Returns an iterator over the elements of this collection.
@frozen struct Iterator
An iterator that produces one or zero instances of an element.
typealias Index = Int
typealias Indices = Range<Int>
typealias SubSequence = Slice<CollectionOfOne<Element>>