Skip to content

Expose Delegate Methods #17

@mergesort

Description

@mergesort

I'm trying to add functionality to my ResponsiveTextField that normally would be exposed through a UITextFieldDelegate, such as preventing a UITextField from dismissing.

final class AlwaysDisplayingTextFieldDelegate: NSObject, UITextFieldDelegate {
    func textFieldShouldEndEditing(_ textField: UITextField) -> Bool {
        false
    }
}

My initial approach was to try creating a delegate and setting that delegate within the configuration. (Note: that leads to a correct warning Instance will be immediately deallocated because property 'delegate' is 'weak'.)

static var `default`: Self {
    ResponsiveTextField.Configuration(configure: {
        $0.autocapitalizationType = .none
        $0.autocorrectionType = .no

        $0.delegate = AlwaysDisplayingTextFieldDelegate()
    })
}

Is there any way to add functionality to a ResponsiveTextField through the delegate, or to prevent a keyboard from ever dismissing that I may be overlooking?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions