-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSampleCode.swift
62 lines (51 loc) · 2.06 KB
/
SampleCode.swift
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// SampleCode.swift
// AppSymbol
//
// Created by Malith Kamburapola on 2022-01-17.
//
import UIKit
class AppSymbol_Sample: UIViewController {
private var shareButton: UIButton = {
let btn = UIButton.init(with: .squareAndArrowUp, to: .systemFont(ofSize: 17, weight: .medium), for: .normal, scale: .medium)
btn.frame = .init(origin: .init(x: 50, y: 100),
size: .init(width: 100, height: 45))
btn.setTitle("Share", for: .normal)
btn.setTitleColor(.systemBlue, for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 17, weight: .medium)
btn.tintColor = .systemBlue
btn.backgroundColor = .black.withAlphaComponent(0.12)
btn.layer.cornerRadius = 3
btn.imageEdgeInsets = .init(top: 0, left: 0, bottom: 0, right: 8)
return btn
}()
private var lockButton: UIButton = {
let btn = UIButton.init(with: .lockOpenLine, to: .systemFont(ofSize: 17, weight: .medium), for: .normal, scale: .medium)
btn.frame = .init(origin: .init(x: 50, y: 200),
size: .init(width: 120, height: 45))
btn.setTitle("Unlocked", for: .normal)
btn.setTitleColor(.systemGreen, for: .normal)
btn.titleLabel?.font = .systemFont(ofSize: 17, weight: .medium)
btn.tintColor = .systemGreen
btn.backgroundColor = .black.withAlphaComponent(0.08)
btn.layer.cornerRadius = 3
btn.imageEdgeInsets = .init(top: 0, left: 0, bottom: 0, right: 8)
return btn
}()
override func insertAndLayoutSubviews() {
view.addSubview(shareButton)
view.addSubview(lockButton)
}
override func config() {
view.backgroundColor = .white
}
override func viewDidLoad() {
super.viewDidLoad()
insertAndLayoutSubviews()
config()
}
}
extension AppSymbolNames {
static var squareAndArrowUp: AppSymbolNameType { .init(rawValue: "square.and.arrow.up") }
static var lockOpenLine: AppSymbolNameType { .init(rawValue: "lock.open.line") }
}