Two (really) simple Swift 4 UIView classes with a triangle and a diagonal line rendered and customizable in the storyboard (color, line width, direction)
Triangle: UIView and DiagonalLine: UIView are @IBDesignable classes so that they are rendered in your storyboard, and all their properties are @IBInspectable so that you can customize your triangle and diagonal view inside the storyboard in the Attributes inspector.
-
Just drag these classes into your project
-
In your storyboard, select a UIView
-
Go the the identity inspector and in the class field, type Triangle or DiagonalView instead of UIView
-
Play with the attributes inspector with real-times results!
- Triangle: pick a fill color
- Diagonal: pick a color for your line
- Triangle: choose the three points x and y positions (0 to 1) to create any triangle you want!
- Diagonal: choose the direction (flip)
- Diagonal: specify the line width