-
Notifications
You must be signed in to change notification settings - Fork 410
/
Copy pathBTConfiguration.swift
83 lines (78 loc) · 3.53 KB
/
BTConfiguration.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// BTConfiguration.swift
//
// Copyright (c) 2017 PHAM BA THO ([email protected]). All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import UIKit
final class BTConfiguration {
var menuTitleColor: UIColor?
var menuTitleMaxWidth: CGFloat?
var menuTitleBreakModel : NSLineBreakMode!
var cellHeight: CGFloat!
var cellBackgroundColor: UIColor?
var cellSeparatorColor: UIColor?
var cellTextLabelColor: UIColor?
var selectedCellTextLabelColor: UIColor?
var cellTextLabelFont: UIFont!
var navigationBarTitleFont: UIFont!
var cellTextLabelAlignment: NSTextAlignment!
var cellSelectionColor: UIColor?
var checkMarkImage: UIImage!
var shouldKeepSelectedCellColor: Bool!
var arrowTintColor: UIColor?
var arrowImage: UIImage!
var arrowPadding: CGFloat!
var animationDuration: TimeInterval!
var maskBackgroundColor: UIColor!
var maskBackgroundOpacity: CGFloat!
var shouldChangeTitleText: Bool!
init() {
self.defaultValue()
}
func defaultValue() {
// Path for image
let bundle = Bundle(for: BTConfiguration.self)
let url = bundle.url(forResource: "BTNavigationDropdownMenu", withExtension: "bundle")
let imageBundle = Bundle(url: url!)
let checkMarkImagePath = imageBundle?.path(forResource: "checkmark_icon", ofType: "png")
let arrowImagePath = imageBundle?.path(forResource: "arrow_down_icon", ofType: "png")
// Default values
self.menuTitleColor = UIColor.darkGray
self.menuTitleBreakModel = .byTruncatingMiddle
self.cellHeight = 50
self.cellBackgroundColor = UIColor.white
self.arrowTintColor = UIColor.white
self.cellSeparatorColor = UIColor.darkGray
self.cellTextLabelColor = UIColor.darkGray
self.selectedCellTextLabelColor = UIColor.darkGray
self.cellTextLabelFont = UIFont(name: "HelveticaNeue-Bold", size: 17)
self.navigationBarTitleFont = UIFont(name: "HelveticaNeue-Bold", size: 17)
self.cellTextLabelAlignment = NSTextAlignment.left
self.cellSelectionColor = UIColor.lightGray
self.checkMarkImage = UIImage(contentsOfFile: checkMarkImagePath!)
self.shouldKeepSelectedCellColor = false
self.animationDuration = 0.5
self.arrowImage = UIImage(contentsOfFile: arrowImagePath!)
self.arrowPadding = 15
self.maskBackgroundColor = UIColor.black
self.maskBackgroundOpacity = 0.3
self.shouldChangeTitleText = true
}
}