Created
January 18, 2019 02:56
-
-
Save Aymenworks/df8600899b8859c74bfbb7b3fb046bdb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class SearchView: UIView { | |
// MARK: Properties | |
... | |
struct Colors { | |
static let backgroundButtonBackgroundColor = UIColor.clear | |
static let backgroundButtonTintColor = #colorLiteral(red: 0.6000000238, green: 0.6000000238, blue: 0.6000000238, alpha: 1) | |
static let foregroundButtonBackgroundColor = #colorLiteral(red: 1, green: 0.8, blue: 0, alpha: 1) | |
static let foregroundButtonTintColor = #colorLiteral(red: 1, green: 1, blue: 1, alpha: 1) | |
} | |
let shapeLayer = CAShapeLayer() | |
let backgroundButton = UIButton() | |
let foregroundButton = UIButton() | |
// MARK: Setup | |
func setup() { | |
UI: do { | |
backgroundButton.setImage(UIImage(named: "search"), for: .normal) | |
backgroundButton.backgroundColor = Colors.backgroundButtonBackgroundColor | |
backgroundButton.tintColor = Colors.backgroundButtonTintColor | |
foregroundButton.setImage(UIImage(named: "search"), for: .normal) | |
foregroundButton.backgroundColor = Colors.foregroundButtonBackgroundColor | |
foregroundButton.tintColor = Colors.foregroundButtonTintColor | |
} | |
layers: do { | |
foregroundButton.layer.mask = shapeLayer | |
foregroundButton.layer.masksToBounds = true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment