FilePath.ComponentView
A bidirectional, range replaceable collection of the non-root components that make up a file path.
Declaration
struct ComponentViewOverview
ComponentView provides access to standard BidirectionalCollection algorithms for accessing components from the front or back, as well as standard RangeReplaceableCollection algorithms for modifying the file path using component or range of components granularity.
Example:
var path: FilePath = "/./home/./username/scripts/./tree"
let scriptIdx = path.components.lastIndex(of: "scripts")!
path.components.insert("bin", at: scriptIdx)
// path is "/./home/./username/bin/scripts/./tree"
path.components.removeAll { $0.kind == .currentDirectory }
// path is "/home/username/bin/scripts/tree"