Swiftpack.co - Package - std-swift/BidirectionalIterator

BidirectionalIterator

Provides a BidirectionalIterator for BidirectionalCollection types

Importing

import BidirectionalIterator
dependencies: [
	.package(url: "https://github.com/std-swift/BidirectionalIterator.git",
	         from: "1.0.0")
],
targets: [
	.target(
		name: "",
		dependencies: [
			"BidirectionalIterator"
		]),
]

Using

let animals = ["Antelope", "Butterfly", "Camel", "Dolphin"]
var animalIterator = animals.makeBidirectionalIterator()
animalIterator.next()     // .some("Antelope")
animalIterator.next()     // .some("Butterfly")
animalIterator.previous() // .some("Butterfly")
animalIterator.next()     // .some("Butterfly")

Github

link
Stars: 0
Help us keep the lights on

Dependencies

Used By

Total: 0