How to set the spacing of cell through override in swift?

use the following writing in OC to make tableViewCell have spacing

- (void)setFrame:(CGRect)frame{
     frame.origin.y += 15;
    frame.size.height -= 15;
    [super setFrame:frame];
}

in Swift, I use the following to conclude that the height of the cell is not correct

override var frame: CGRect {
        get { return super.frame }
        set {
            var updateFrame = frame
            updateFrame.origin.y += 10
            updateFrame.size.height -= 10
            super.frame = updateFrame
        }
    }
Ios
Mar.18,2021

override var frame: CGRect {

    
    didSet {
        
        var newFrame = frame
        newFrame.origin.x += 10
        newFrame.size.width -= 10*2
        newFrame.origin.y += 12
        newFrame.size.height -= 10
        super.frame = newFrame
    }
}
Menu