CSMButton.swift
1023 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//
// CSMButton.swift
// SwiftWarplyFramework
//
// Created by Dimitris Togias on 14/9/22.
//
import UIKit
@IBDesignable
class CSMButton: UIButton {
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
configure()
}
override init(frame: CGRect = .zero) {
super.init(frame: frame)
configure()
}
override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
configure()
}
}
private extension CSMButton {
func configure() {
setImage(UIImage(named: "directions"), for: .normal)
titleLabel?.font = UIFont(name: "PFSquareSansPro-Medium", size: 16)
setTitleColor(.white, for: .normal)
backgroundColor = UIColor(red: 0.47, green: 0.75, blue: 0.08, alpha: 1.00)
layer.cornerRadius = 12.0
imageEdgeInsets = UIEdgeInsets(top:0.0, left:0.0, bottom:0.0, right:5.0);
titleEdgeInsets = UIEdgeInsets(top:0.0, left:5.0, bottom:0.0, right:0.0);
}
}