luximetr/AnyFormatKit

Proper way to create a custom TextInputFormatter

czrml opened this issue · 1 comments

czrml commented

Hello, I'm using the library but needed some custom input formatter, my first instinct was to check the implementation of the DefaultTextInputFormatter and copying its structure changing it for my case.

However when overriding theformatInput(currentText: String, range: NSRange, replacementString text: String) -> FormattedTextValue function I can't init the FormattedTextValue type due to the struct not having a public init

Is there a way to achieve what I'm looking using other methods or the lib should have a public init for this case?

Public init for FormattedTextValue has been added. It is now available from version 2.0.5.