Instance Method

enumerateLines(_:)

Enumerates all the lines in a string.

Declaration

func enumerateLines(_ block: @escaping (String, UnsafeMutablePointer<ObjCBool>) -> Void)

Parameters

block

The block executed for the enumeration.

The block takes two arguments:

line

The current line of the string being enumerated. The line contains just the contents of the line, without the line terminators. See getLineStart(_:end:contentsEnd:for:) for a discussion of line terminators.

stop

A reference to a Boolean value that the block can use to stop the enumeration by setting *stop = YES; it should not touch *stop otherwise.