AsyncTextResolving
public protocol AsyncTextResolving
An object capable of resolving text asynchronously to another representation. New representation may contain change in attributes or the string itself.
-
Name of the Resolver. This name must be applied to the range of text that requires async resolution with attribute key:
.asyncTextResolverDeclaration
Swift
var name: String { get } -
Resolves the string to a different representation
Important
As part of resolution,.asyncTextResolveris removed from original range. If the content in original range has changed in the time it took for resolution, it is responsibility of consumer to cleanup dangling attribute, if any.Declaration
Swift
func resolve(using editor: EditorView, range: NSRange, string: NSAttributedString, completion: @escaping (AsyncTextResolvingResult) -> Void)Parameters
editorEditor containing the attributed string
rangeRange of attributesString containing
.asyncTextResolverattributestringSubstring of attributesString containing
.asyncTextResolverattributecompletionTransformed result to be applied.
.applywill replace therangeinEditorwith providedattributedString. ..discarddiscards the operation.
View on GitHub
AsyncTextResolving Protocol Reference