LMFeedPickerView
Overview
The LMFeedPickerView
is a customizable picker view that extends UIPickerView
and provides a built-in toolbar with Done and Cancel actions. It is designed for use in forms and selection dialogs within feed UIs, allowing for easy integration of picker-based input with toolbar controls.
File Location:
LMFeedPickerView.swift
Functionality
UI Components
toolbar
: The toolbar displayed above the picker, containing Done and Cancel buttonstoolbarDelegate
: Delegate for handling Done and Cancel actions
Methods
init(frame:)
: Initializes the picker view and sets up the toolbarinit?(coder:)
: Initializes the picker view from a storyboard or nib and sets up the toolbarcommonInit()
: Sets up the toolbar and its buttonsdoneTapped()
: Called when the Done button is tapped, notifies the delegatecancelTapped()
: Called when the Cancel button is tapped, notifies the delegate
Protocols
LMFeedPickerViewDelegate
: Protocol for handling toolbar actions (didTapDone
,didTapCancel
)
Customization
CustomFeedPickerView.swift
class CustomFeedPickerView: LMFeedPickerView {
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.pickerView = CustomFeedPickerView.self
// ...
return true
}