How to stop enumerating attributes of a NSAttributedString?

后端 未结 1 892
慢半拍i
慢半拍i 2021-01-12 12:16

In the documentation of the enumerateAttribute method it is said, regarding the stop argument of the block, that:

The block

1条回答
  •  醉梦人生
    2021-01-12 12:30

    The parameter is a reference that holds the actual value:

    let attributed: NSAttributedString = ...
    
    attributed.enumerateAttribute(
        NSFontAttributeName,
        in: NSRange(location: 0, length: attributed.length),
        options: []
    ) { value, range, stop in
        stop.pointee = true
    }
    

    See the reference for UnsafeMutablePointer.

    0 讨论(0)
提交回复
热议问题