How to add custom UIView on UITableViewCell Swipe in swift?


I want to add custom UIView on UITableViewCell Swipe. Basically I want to add two UIButton, one on top and other just below it. Both having height half of cell. If I use editActionsForRowAtIndexPath delegate method of UITableView that this add UIButton side by side but i want to add buttons on top having height equal to half of table view cell and other just below it having same height.

Thanks in advance!!!

you can add this code in your custom tableview cell:

var topBtn = UIButton()
var behindBtn = UIButton()

override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)

override func awakeFromNib() {
    topBtn.setTitle("top", for: .normal)
    topBtn.backgroundColor =

    behindBtn.setTitle("behind", for: .normal)
    behindBtn.backgroundColor =

override func layoutSubviews() {
    let btnH = self.frame.size.height/2
    let btnW = self.frame.size.width

    topBtn.frame = CGRect(x: 0, y: 0, width: btnW, height: btnH)
    behindBtn.frame = CGRect(x: 0, y: btnH, width: btnW, height: btnH)

required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")

and this is the result: