@@ -40,69 +40,69 @@ class ViewController: UIViewController {
40
40
41
41
//MARK: - Actions
42
42
43
- @IBAction func chooseArticle( sender: AnyObject ) {
43
+ @IBAction func chooseArticle( _ sender: AnyObject ) {
44
44
chooseArticleDropDown. show ( )
45
45
}
46
46
47
- @IBAction func changeAmount( sender: AnyObject ) {
47
+ @IBAction func changeAmount( _ sender: AnyObject ) {
48
48
amountDropDown. show ( )
49
49
}
50
50
51
- @IBAction func choose( sender: AnyObject ) {
51
+ @IBAction func choose( _ sender: AnyObject ) {
52
52
chooseDropDown. show ( )
53
53
}
54
54
55
- @IBAction func showCenteredDropDown( sender: AnyObject ) {
55
+ @IBAction func showCenteredDropDown( _ sender: AnyObject ) {
56
56
centeredDropDown. show ( )
57
57
}
58
58
59
- @IBAction func showBarButtonDropDown( sender: AnyObject ) {
59
+ @IBAction func showBarButtonDropDown( _ sender: AnyObject ) {
60
60
rightBarDropDown. show ( )
61
61
}
62
62
63
- @IBAction func changeDIsmissMode( sender: UISegmentedControl ) {
63
+ @IBAction func changeDIsmissMode( _ sender: UISegmentedControl ) {
64
64
switch sender. selectedSegmentIndex {
65
- case 0 : dropDowns. forEach { $0. dismissMode = . Automatic }
66
- case 1 : dropDowns. forEach { $0. dismissMode = . OnTap }
65
+ case 0 : dropDowns. forEach { $0. dismissMode = . automatic }
66
+ case 1 : dropDowns. forEach { $0. dismissMode = . onTap }
67
67
default : break ;
68
68
}
69
69
}
70
70
71
- @IBAction func changeDirection( sender: UISegmentedControl ) {
71
+ @IBAction func changeDirection( _ sender: UISegmentedControl ) {
72
72
switch sender. selectedSegmentIndex {
73
- case 0 : dropDowns. forEach { $0. direction = . Any }
74
- case 1 : dropDowns. forEach { $0. direction = . Bottom }
75
- case 2 : dropDowns. forEach { $0. direction = . Top }
73
+ case 0 : dropDowns. forEach { $0. direction = . any }
74
+ case 1 : dropDowns. forEach { $0. direction = . bottom }
75
+ case 2 : dropDowns. forEach { $0. direction = . top }
76
76
default : break ;
77
77
}
78
78
}
79
79
80
- @IBAction func changeUI( sender: UISegmentedControl ) {
80
+ @IBAction func changeUI( _ sender: UISegmentedControl ) {
81
81
switch sender. selectedSegmentIndex {
82
82
case 0 : setupDefaultDropDown ( )
83
83
case 1 : customizeDropDown ( self )
84
84
default : break ;
85
85
}
86
86
}
87
87
88
- @IBAction func showKeyboard( sender: AnyObject ) {
88
+ @IBAction func showKeyboard( _ sender: AnyObject ) {
89
89
textField. becomeFirstResponder ( )
90
90
}
91
91
92
- @IBAction func hideKeyboard( sender: AnyObject ) {
92
+ @IBAction func hideKeyboard( _ sender: AnyObject ) {
93
93
view. endEditing ( false )
94
94
}
95
95
96
96
func setupDefaultDropDown( ) {
97
97
DropDown . setupDefaultAppearance ( )
98
98
99
99
dropDowns. forEach {
100
- $0. cellNib = UINib ( nibName: " DropDownCell " , bundle: NSBundle ( forClass : DropDownCell . self) )
100
+ $0. cellNib = UINib ( nibName: " DropDownCell " , bundle: Bundle ( for : DropDownCell . self) )
101
101
$0. customCellConfiguration = nil
102
102
}
103
103
}
104
104
105
- func customizeDropDown( sender: AnyObject ) {
105
+ func customizeDropDown( _ sender: AnyObject ) {
106
106
let appearance = DropDown . appearance ( )
107
107
108
108
appearance. cellHeight = 60
@@ -114,7 +114,7 @@ class ViewController: UIViewController {
114
114
appearance. shadowOpacity = 0.9
115
115
appearance. shadowRadius = 25
116
116
appearance. animationduration = 0.25
117
- appearance. textColor = . darkGrayColor ( )
117
+ appearance. textColor = . darkGray
118
118
// appearance.textFont = UIFont(name: "Georgia", size: 14)
119
119
120
120
dropDowns. forEach {
@@ -137,8 +137,8 @@ class ViewController: UIViewController {
137
137
super. viewDidLoad ( )
138
138
139
139
setupDropDowns ( )
140
- dropDowns. forEach { $0. dismissMode = . OnTap }
141
- dropDowns. forEach { $0. direction = . Any }
140
+ dropDowns. forEach { $0. dismissMode = . onTap }
141
+ dropDowns. forEach { $0. direction = . any }
142
142
143
143
view. addSubview ( textField)
144
144
}
@@ -175,7 +175,7 @@ class ViewController: UIViewController {
175
175
176
176
// Action triggered on selection
177
177
chooseArticleDropDown. selectionAction = { [ unowned self] ( index, item) in
178
- self . chooseArticleButton. setTitle ( item, forState : . Normal )
178
+ self . chooseArticleButton. setTitle ( item, for : . normal )
179
179
}
180
180
181
181
// Action triggered on dropdown cancelation (hide)
@@ -215,7 +215,7 @@ class ViewController: UIViewController {
215
215
216
216
// Action triggered on selection
217
217
amountDropDown. selectionAction = { [ unowned self] ( index, item) in
218
- self . amountButton. setTitle ( item, forState : . Normal )
218
+ self . amountButton. setTitle ( item, for : . normal )
219
219
}
220
220
}
221
221
@@ -236,7 +236,7 @@ class ViewController: UIViewController {
236
236
237
237
// Action triggered on selection
238
238
chooseDropDown. selectionAction = { [ unowned self] ( index, item) in
239
- self . chooseButton. setTitle ( item, forState : . Normal )
239
+ self . chooseButton. setTitle ( item, for : . normal )
240
240
}
241
241
}
242
242
0 commit comments