@@ -36,40 +36,40 @@ class ExampleViewController: UITableViewController {
3636 ]
3737
3838 private lazy var flipButton : UIButton = {
39- let _button = UIButton ( type: . System )
40- _button. frame = CGRect ( x: 0 , y: 0 , width: UIScreen . mainScreen ( ) . bounds. width, height: 88 )
41- _button. setTitle ( " Storyboard " , forState : . Normal )
42- _button. addTarget ( self , action: . showStoryboard, forControlEvents : . TouchUpInside )
39+ let _button = UIButton ( type: . system )
40+ _button. frame = CGRect ( x: 0 , y: 0 , width: UIScreen . main . bounds. width, height: 88 )
41+ _button. setTitle ( " Storyboard " , for : UIControlState ( ) )
42+ _button. addTarget ( self , action: . showStoryboard, for : . touchUpInside )
4343 return _button
4444 } ( )
4545
4646 // MARK: - Initialization
4747
4848 convenience init ( ) {
49- self . init ( style: . Grouped )
49+ self . init ( style: . grouped )
5050 title = " ICInputAccessory "
5151 }
5252
5353 // MARK: - UIViewController
5454
5555 override func loadView( ) {
5656 super. loadView ( )
57- tableView. registerClass ( ExampleCell . self, forCellReuseIdentifier: NSStringFromClass ( ExampleCell . self) )
57+ tableView. register ( ExampleCell . self, forCellReuseIdentifier: NSStringFromClass ( ExampleCell . self) )
5858 tableView. tableFooterView = flipButton
59- tableView. tableFooterView? . userInteractionEnabled
59+ tableView. tableFooterView? . isUserInteractionEnabled
6060 }
6161
6262 // MARK: - UITableViewDataSource
6363
64- override func numberOfSectionsInTableView ( tableView: UITableView ) -> Int {
64+ override func numberOfSections ( in tableView: UITableView ) -> Int {
6565 return types. count
6666 }
6767
68- override func tableView( tableView: UITableView , numberOfRowsInSection section: Int ) -> Int {
68+ override func tableView( _ tableView: UITableView , numberOfRowsInSection section: Int ) -> Int {
6969 return 1
7070 }
7171
72- override func tableView( tableView: UITableView , titleForHeaderInSection section: Int ) -> String ? {
72+ override func tableView( _ tableView: UITableView , titleForHeaderInSection section: Int ) -> String ? {
7373 switch types [ section] {
7474 case is ICKeyboardDismissTextField . Type :
7575 return " Dismiss Keyboard "
@@ -82,26 +82,26 @@ class ExampleViewController: UITableViewController {
8282 }
8383 }
8484
85- override func tableView( tableView: UITableView , cellForRowAtIndexPath indexPath: NSIndexPath ) -> UITableViewCell {
86- let cell = tableView. dequeueReusableCellWithIdentifier ( NSStringFromClass ( ExampleCell . self) , forIndexPath : indexPath)
87- switch types [ indexPath. section] {
85+ override func tableView( _ tableView: UITableView , cellForRowAt indexPath: IndexPath ) -> UITableViewCell {
86+ let cell = tableView. dequeueReusableCell ( withIdentifier : NSStringFromClass ( ExampleCell . self) , for : indexPath)
87+ switch types [ ( indexPath as NSIndexPath ) . section] {
8888 case let type as ICKeyboardDismissTextField . Type :
89- let textField = type. init ( )
90- textField. leftViewMode = . Always
89+ let textField = type. ` init` ( boundsSize : requestHandler : ) ( )
90+ textField. leftViewMode = . always
9191 textField. leftView = UIView ( frame: CGRect ( x: 0 , y: 0 , width: 15 , height: 15 ) )
9292 textField. placeholder = String ( type)
9393 ( cell as? ExampleCell ) ? . showcase = textField
9494
9595 case let type as CustomizedTokenField . Type :
9696 cell. textLabel? . text = String ( type)
97- cell. accessoryType = . DisclosureIndicator
97+ cell. accessoryType = . disclosureIndicator
9898
9999 case let type as ICTokenField . Type :
100100 let container = UIView ( frame: cell. bounds)
101- let tokenField = type. init ( )
101+ let tokenField = type. ` init` ( boundsSize : requestHandler : ) ( )
102102 tokenField. placeholder = String ( type)
103103 tokenField. frame = container. bounds. insetBy ( dx: 5 , dy: 0 )
104- tokenField. autoresizingMask = [ . FlexibleWidth , . FlexibleHeight ]
104+ tokenField. autoresizingMask = [ . flexibleWidth , . flexibleHeight ]
105105 container. addSubview ( tokenField)
106106 ( cell as? ExampleCell ) ? . showcase = container
107107
@@ -113,22 +113,22 @@ class ExampleViewController: UITableViewController {
113113
114114 // MARK: - UITableViewDelegate
115115
116- override func tableView( tableView: UITableView , shouldHighlightRowAtIndexPath indexPath: NSIndexPath ) -> Bool {
117- return types [ indexPath. section] == CustomizedTokenField . self
116+ override func tableView( _ tableView: UITableView , shouldHighlightRowAt indexPath: IndexPath ) -> Bool {
117+ return types [ ( indexPath as NSIndexPath ) . section] == CustomizedTokenField . self
118118 }
119119
120- override func tableView( tableView: UITableView , didSelectRowAtIndexPath indexPath: NSIndexPath ) {
121- if types [ indexPath. section] == CustomizedTokenField . self {
122- presentViewController ( UINavigationController ( rootViewController: CustomizedTokenViewController ( ) ) , animated: true , completion: nil )
120+ override func tableView( _ tableView: UITableView , didSelectRowAt indexPath: IndexPath ) {
121+ if types [ ( indexPath as NSIndexPath ) . section] == CustomizedTokenField . self {
122+ present ( UINavigationController ( rootViewController: CustomizedTokenViewController ( ) ) , animated: true , completion: nil )
123123 }
124124 }
125125
126126 // MARK: - UIResponder Callbacks
127127
128- @objc private func showStoryboard( sender: UIButton ) {
129- if let controller = UIStoryboard ( name: " Main " , bundle: NSBundle . mainBundle ( ) ) . instantiateInitialViewController ( ) {
130- controller. modalTransitionStyle = . FlipHorizontal
131- presentViewController ( controller, animated: true , completion: nil )
128+ @objc private func showStoryboard( _ sender: UIButton ) {
129+ if let controller = UIStoryboard ( name: " Main " , bundle: Bundle . main ) . instantiateInitialViewController ( ) {
130+ controller. modalTransitionStyle = . flipHorizontal
131+ present ( controller, animated: true , completion: nil )
132132 }
133133 }
134134
0 commit comments