BagIterator public struct BagIterator<Element>: IteratorProtocol An iterator of Bag. next() An iterator of Bag. Declaration Swift public mutating func next() -> Element? Return Value The next element in the underlying sequence, if a next element exists; otherwise, nil.