AutocompleteManager
open class AutocompleteManager : NSObject, InputPlugin, UITextViewDelegate, UITableViewDelegate, UITableViewDataSource
Undocumented
-
A protocol that passes data to the
AutocompleteManager
Declaration
Swift
open weak var dataSource: AutocompleteManagerDataSource?
-
A protocol that more precisely defines
AutocompleteManager
logicDeclaration
Swift
open weak var delegate: AutocompleteManagerDelegate?
-
A reference to the
InputTextView
that theAutocompleteManager
is usingDeclaration
Swift
private(set) public weak var textView: UITextView? { get }
-
Undocumented
Declaration
Swift
public var inputTextView: InputTextView? { get }
-
An ongoing session reference that holds the prefix, range and text to complete with
Declaration
Swift
private(set) public var currentSession: AutocompleteSession? { get }
-
The
AutocompleteTableView
that renders available autocompletes for thecurrentSession
Declaration
Swift
open lazy var tableView: AutocompleteTableView { get set }
-
Adds an additional space after the autocompleted text when true. Default value is
TRUE
Declaration
Swift
open var appendSpaceOnCompletion: Bool
-
Keeps the prefix typed when text is autocompleted. Default value is
TRUE
Declaration
Swift
open var keepPrefixOnCompletion: Bool
-
Allows a single space character to be entered mid autocompletion.
For example, your autocomplete is
Nathan Tannar
, the .whitespace deliminater set would terminate the session afterNathan
. By settingmaxSpaceCountDuringCompletion
the session termination will disregard that number of spacesDefault value is
0
Declaration
Swift
open var maxSpaceCountDuringCompletion: Int
-
When enabled, autocomplete completions that contain whitespace will be deleted in parts. This meands backspacing on
@Nathan Tannar
will result inTannar
being removed first with a second backspace action required to delete@Nathan
Default value is
TRUE
Declaration
Swift
open var deleteCompletionByParts: Bool
-
The default text attributes
Declaration
Swift
open var defaultTextAttributes: [NSAttributedString.Key : Any]
-
The NSAttributedString.Key.paragraphStyle value applied to attributed strings
Declaration
Swift
public let paragraphStyle: NSMutableParagraphStyle
-
A block that filters the
AutocompleteCompletion
‘s sourced from thedataSource
, based on theAutocompleteSession
. The default function requires theAutocompleteCompletion.text
string contains theAutocompleteSession.filter
string ignoring caseDeclaration
Swift
open var filterBlock: (AutocompleteSession, AutocompleteCompletion) -> (Bool)
-
The prefices that the manager will recognize
Declaration
Swift
public private(set) var autocompletePrefixes: Set<String> { get }
-
The delimiters that the manager will terminate a session with The default value is: [.whitespaces, .newlines]
Declaration
Swift
public private(set) var autocompleteDelimiterSets: Set<CharacterSet> { get }
-
The text attributes applied to highlighted substrings for each prefix
Declaration
Swift
public private(set) var autocompleteTextAttributes: [String : [NSAttributedString.Key : Any]] { get }
-
Undocumented
Declaration
Swift
public init(for textView: UITextView)
-
Reloads the InputPlugin’s session
Declaration
Swift
open func reloadData()
-
Invalidates the InputPlugin’s session
Declaration
Swift
open func invalidate()
-
Passes an object into the InputPlugin’s session to handle
Declaration
Swift
@discardableResult open func handleInput(of object: AnyObject) -> Bool
Parameters
object
A string to append
-
Registers a prefix and its the attributes to apply to its autocompleted strings
Declaration
Swift
open func register(prefix: String, with attributedTextAttributes: [NSAttributedString.Key : Any]? = nil)
Parameters
prefix
The prefix such as: @, # or !
attributedTextAttributes
The attributes to apply to the NSAttributedString
-
Unregisters a prefix and removes its associated cached attributes
Declaration
Swift
open func unregister(prefix: String)
Parameters
prefix
The prefix such as: @, # or !
-
Registers a CharacterSet as a delimiter
Declaration
Swift
open func register(delimiterSet set: CharacterSet)
Parameters
delimiterSet
The
CharacterSet
to recognize as a delimiter -
Unregisters a CharacterSet
Declaration
Swift
open func unregister(delimiterSet set: CharacterSet)
Parameters
delimiterSet
The
CharacterSet
to recognize as a delimiter -
Replaces the current prefix and filter text with the supplied text
Declaration
Swift
open func autocomplete(with session: AutocompleteSession)
Parameters
text
The replacement text
-
Returns an attributed string with bolded characters matching the characters typed in the session
Declaration
Swift
open func attributedText(matching session: AutocompleteSession, fontSize: CGFloat = 15, keepPrefix: Bool = true) -> NSMutableAttributedString
Parameters
session
The
AutocompleteSession
to form anNSMutableAttributedString
withReturn Value
An
NSMutableAttributedString
-
Undocumented
Declaration
Swift
public func textViewDidChange(_ textView: UITextView)
-
Undocumented
Declaration
Swift
public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool
-
Undocumented
Declaration
Swift
open func numberOfSections(in tableView: UITableView) -> Int
-
Undocumented
Declaration
Swift
open func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
-
Undocumented
Declaration
Swift
open func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
-
Undocumented
Declaration
Swift
open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)
-
If the autocomplete matches should be made by casting the strings to lowercase. Default value is
FALSE
DEPRICATED; will always returnFALSE
Declaration
Swift
@available(*, deprecated, message: "`isCaseSensitive` was replaced in favour of a more customizable `filterBlock: (String﹚ -> (Bool﹚`") public var isCaseSensitive: Bool { get set }