Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattrobmattrob/08d560a620a3e5e0a74ce83b70dbeee9 to your computer and use it in GitHub Desktop.
Save mattrobmattrob/08d560a620a3e5e0a74ce83b70dbeee9 to your computer and use it in GitHub Desktop.
extension BubbleView {
func drawBubble(in bubbleBounds: CGRect, bubbleColor: UIColor) {
// 1.
guard let context = UIGraphicsGetCurrentContext() else { return }
// 2.
context.setFillColor(bubbleColor.cgColor)
// 3.
context.fillEllipse(in: bounds)
}
}
final class BubbleView: UIView {
override func draw(_ rect: CGRect) {
drawBubble(in: bounds, bubbleColor: .orange)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment