Created
July 1, 2020 19:14
-
-
Save mattrobmattrob/08d560a620a3e5e0a74ce83b70dbeee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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