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.

  • textDictionary Default implementation

    This 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 getTextDictionaryFromThis method is all that is necessary to supply the searchable Array. If you are using the default implementation of getTextDictionaryFromThis, then you MUST provide your own version of this Array. However, if you do leave this undefined, then you MUST implement your own version of getTextDictionaryFromThis. If this is not implemented, or is empty, and there is no custom implementation of getTextDictionaryFromThis, 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 }
  • This searches the Array, for strings that match the given String, according to the parameters included with the invocation. If you do leave textDictionary undefined, 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 implement textDictionary).

    Default Implementation

    Default uses the Array extension subscripts to search the Array. If you do leave textDictionary undefined, 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

    string

    The String to search for

    isCaseSensitive

    False, by default. If true, the String must match case, as well as content.

    isWildcardBefore

    False, by default. If true, then the String can be preceded by other characters. If false, the given String must start the value being tested.

    isWildcardAfter

    True, by default. If true, then the String can be followed by other characters. If false, the given String must end the value being tested.

    maximumAutofillCount

    5, 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_AutofillTextFieldDataSourceType protocol.