I'm trying to give a UITableViewCell a 'waved' bottom to make it look like a 'ripped off paper' effect (for an order receipt). I want to draw this over the whole length of the cell.
I found this solution on StackOverflow, which creates one single sine between two points.
I tried altering that code to make the effect I need (I know there's a lot wrong in my code):
let path = UIBezierPath()
let origin = CGPoint(x: 0, y: bounds.size.height / 2)
path.move(to: origin)
let graphWidth: CGFloat = 0.8 // Graph is 80% of the width of the view
let amplitude: CGFloat = 0.5 // Amplitude of sine wave is 30% of view
for angle in stride(from: 1.0, through: bounds.size.width * 5.0, by: 1.0) {
let x = origin.x + CGFloat(angle/360.0) * bounds.size.width * (360 / (bounds.size.width * 10.0))
let y = origin.y - CGFloat(sin(angle/180.0 * CGFloat.pi)) * bounds.size.height * amplitude * (360 / (bounds.size.width * 10.0))
path.addLine(to: CGPoint(x: x, y: y))
}
What would be the best approach here? If I could get above solution working and looking like the image, that would be perfect. If anyone has other suggestions, I'm open to everything.

