Created
July 1, 2020 19:14
-
-
Save mattrobmattrob/02b15dcd2c4556d314c9c466e823f471 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 { | |
/// Draws a set of stripes across the view up from bottom left | |
/// to top right at a 45 degree angle. The stripes will be | |
/// `stripeWidth` wide and have `stripeWidth` between them. | |
func drawStripes(in bubbleBounds: CGRect, | |
stripeColor: UIColor, | |
stripeWidth: CGFloat) {...} | |
} | |
final class BubbleView: UIView { | |
override func draw(_ rect: CGRect) { | |
drawBubble(in: bounds, bubbleColor: .orange) | |
// Arbitrarily size the size as 1/10th the maximum radius. | |
let stripeWidth = bounds.width / 2.0 * 0.1 | |
drawStripes(in: bounds, | |
stripeColor: UIColor.black.withAlphaComponent(0.3), | |
stripeWidth: stripeWidth) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment