RVS_AutofillTextFieldDataSource
public protocol RVS_AutofillTextFieldDataSource
The text field class will require that it be connected to a data source, which is an instance of a class, struct, or enum that conforms to this protocol. It will supply the data to be displayed in the autofill table. If the data source does not supply any data, then the text field acts just like any other text field.
-
textDictionaryDefault implementationThis is an Array of structs, that are the searchable data collection for the text field. You can leave this undefined in your conformance, as the
getTextDictionaryFromThismethod is all that is necessary to supply the searchable Array. If you are using the default implementation ofgetTextDictionaryFromThis, then you MUST provide your own version of this Array. However, if you do leave this undefined, then you MUST implement your own version ofgetTextDictionaryFromThis. If this is not implemented, or is empty, and there is no custom implementation ofgetTextDictionaryFromThis, then no searches will return any results.Default Implementation
Default is an empty Array. If you are using the default implementation of
getTextDictionaryFromThis, then you MUST provide your own version of this Array.Declaration
Swift
var textDictionary: [RVS_AutofillTextFieldDataSourceType] { get } -
getTextDictionaryFromThis(string:Default implementationisCaseSensitive: isWildcardBefore: isWildcardAfter: maximumAutofillCount: ) This searches the Array, for strings that match the given String, according to the parameters included with the invocation. If you do leave
textDictionaryundefined, then you MUST implement your own version of this method. The protocol default does a rather naive comparison that is likely to be sufficient for most purposes (which requires that you implementtextDictionary).Default Implementation
Default uses the Array extension subscripts to search the Array. If you do leave
textDictionaryundefined, then you MUST implement your own version of this method. We have some defaults:- isCaseSensitive: false
- isWildcardBefore: false
- isWildcardAfter: true
- maximumAutofillCount: 5
The String is required.
Declaration
Swift
func getTextDictionaryFromThis(string: String, isCaseSensitive: Bool, isWildcardBefore: Bool, isWildcardAfter: Bool, maximumAutofillCount: Int) -> [RVS_AutofillTextFieldDataSourceType]Parameters
stringThe String to search for
isCaseSensitiveFalse, by default. If true, the String must match case, as well as content.
isWildcardBeforeFalse, by default. If true, then the String can be preceded by other characters. If false, the given String must start the value being tested.
isWildcardAfterTrue, by default. If true, then the String can be followed by other characters. If false, the given String must end the value being tested.
maximumAutofillCount5, by default. This is the maximum number of results to return. The return can contain fewer elements. If -1, then there is no limit.
Return Value
An Array of elements that conform to the
RVS_AutofillTextFieldDataSourceTypeprotocol.
View on GitHub
RVS_AutofillTextFieldDataSource Protocol Reference