Skip to main content

LMFeedTextField

Overview​

The LMFeedTextField is a customizable text field that extends UITextField and provides a convenient method for adding a Done button to the keyboard. It is useful for forms and input fields in feed UIs.

File Location:
LMFeedTextField.swift

Functionality​

UI Components​

  • Inherits all properties and methods from UITextField

Methods​

  • addDoneButtonOnKeyboard(): Adds a toolbar with a Done button above the keyboard
  • doneButtonAction(): Action called when the Done button is tapped

Customization​

CustomFeedTextField.swift
class CustomFeedTextField: LMFeedTextField {
override init(frame: CGRect) {
super.init(frame: frame)
// Custom setup
}
required init?(coder: NSCoder) {
super.init(coder: coder)
// Custom setup
}
// Add customizations as needed
}
AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
LMUIComponents.shared.textField = CustomFeedTextField.self
// ...
return true
}