I hope this can help you.
func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) - UIView {
if #available(iOS 14.0, *) {
let height: CGFloat = 0.5
for subview in pickerView.subviews {
/* smaller than the row height plus 20 point, such as 40 + 20 = 60*/
if subview.frame.size.height 60 {
if subview.subviews.isEmpty {
let topLineView = UIView()
topLineView.frame = CGRect(x: 0.0, y: 0.0, width: subview.frame.size.width, height: height)
topLineView.backgroundColor = .lightGray
subview.addSubview(topLineView)
let bottomLineView = UIView()
bottomLineView.frame = CGRect(x: 0.0, y: subview.frame.size.height - height, width: subview.frame.size.width, height: height)
bottomLineView.backgroundColor = .lightGray
subview.addSubview(bottomLineView)
}
}
subview.backgroundColor = .clear
}
}
let label = UILabel()
return label
}