I was trying to create custom options for gradient using IBDesignable following this tutorial, but I get unexpected errors even just coping code from tutorial
import UIKit
@IBDesignable
class GradientView: UIView {
@IBInspectable var FirstColor: UIColor.clear{
didSet {
updateView ()
}
}
@IBInspectable var SecondColor: UIColor.clear{
didSet {
updateView ()
}
}
@IBInspectable var ThirdColor: UIColor.clear{
didSet {
updateView ()
}
func updateView() {
}
}
}
Should be like this:
import UIKit
@IBDesignable
class GradientView: UIView {
@IBInspectable var FirstColor: UIColor = .clear {
didSet {
updateView()
}
}
@IBInspectable var SecondColor: UIColor = .clear {
didSet {
updateView()
}
}
@IBInspectable var ThirdColor: UIColor = .clear {
didSet {
updateView()
}
}
func updateView() {
}
}