Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

List_Item

mattt edited this page Jan 16, 2021 · 12 revisions

List.Item

public final class Item: Node

Inheritance

Node, Visitable, ListItemConvertible

Initializers

init(children:)

public convenience init(children: [Inline & Node] = [])

init(children:)

public convenience init(children: [Block & Node] = [])

init(_:)

public convenience init(_ closure: () -> String)

init(_:)

public convenience init(_ builder: () -> BlockConvertible)

Properties

children

The elements contained by the list item.

var children: [Node]

listItemValue

var listItemValue: [List.Item]

Methods

prepend(child:)

Adds a node to the beginning of the list item's children.

@discardableResult public func prepend(child: Node) -> Bool

Parameters

  • child: The node to add.

Returns

true if successful, otherwise false.

append(child:)

Adds a node to the end of the list item's children.

@discardableResult public func append(child: Node) -> Bool

Parameters

  • child: The node to add.

Returns

true if successful, otherwise false.

insert(child:before:)

Inserts a node to the list item's children before a specified sibling.

@discardableResult public func insert(child: Node, before sibling: Node) -> Bool

Parameters

  • child: The node to add.
  • sibling: The child before which the node is added

Returns

true if successful, otherwise false.

insert(child:after:)

Inserts a node to the list item's children after a specified sibling.

@discardableResult public func insert(child: Node, after sibling: Node) -> Bool

Parameters

  • child: The node to add.
  • sibling: The child after which the node is added

Returns

true if successful, otherwise false.

replace(child:with:)

Replaces a node with a specified node.

@discardableResult public func replace(child: Node, with replacement: Node) -> Bool

Parameters

  • child: The node to replace.
  • replacement: The node to replace the existing node.

Returns

true if successful, otherwise false.

remove(child:)

Removes a node from the list item's children.

@discardableResult public func remove(child: Node) -> Bool

Parameters

  • child: The node to remove.

Returns

true if successful, otherwise false.

removeChildren()

Removes and returns the list item's children.

public func removeChildren() -> [Node]

Returns

An array of nodes.

accept(visitor:)

public func accept<T: Visitor>(visitor: T)
Clone this wiki locally