Skip to content

Commit b2a27dc

Browse files
committed
Merge branch 'feature/swift-2.2' into develop
2 parents fa72d6c + 8019c68 commit b2a27dc

6 files changed

Lines changed: 26 additions & 21 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: objective-c
2-
osx_image: xcode7.2
2+
osx_image: xcode7.3
33
env:
44
matrix:
55
- VERSION=8.4

Example/Example/CustomizedTokenViewController.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate {
5050
navigationController?.navigationBar.translucent = false
5151
navigationController?.navigationBar.barStyle = .Black
5252

53-
let cancelBarButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: Selector("dismiss:"))
53+
let cancelBarButton = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(dismiss(_:)))
5454
cancelBarButton.tintColor = UIColor.whiteColor()
5555
navigationItem.rightBarButtonItem = cancelBarButton
5656

@@ -72,15 +72,15 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate {
7272
// MARK: - ICTokenFieldDelegate
7373

7474
func tokenFieldDidBeginEditing(tokenField: ICTokenField) {
75-
print(__FUNCTION__)
75+
print(#function)
7676
}
7777

7878
func tokenFieldDidEndEditing(tokenField: ICTokenField) {
79-
print(__FUNCTION__)
79+
print(#function)
8080
}
8181

8282
func tokenFieldWillReturn(tokenField: ICTokenField) {
83-
print(__FUNCTION__)
83+
print(#function)
8484
}
8585

8686
func tokenField(tokenField: ICTokenField, didEnterText text: String) {
@@ -95,7 +95,7 @@ class CustomizedTokenViewController: UIViewController, ICTokenFieldDelegate {
9595

9696
// MARK: - UIResponder Callbacks
9797

98-
@IBAction private func dismiss(sender: UIBarButtonItem) {
98+
@objc private func dismiss(sender: UIBarButtonItem) {
9999
presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
100100
}
101101

Example/Example/ExampleViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class ExampleViewController: UITableViewController {
3939
let _button = UIButton(type: .System)
4040
_button.frame = CGRect(x: 0, y: 0, width: UIScreen.mainScreen().bounds.width, height: 88)
4141
_button.setTitle("Storyboard", forState: .Normal)
42-
_button.addTarget(self, action: Selector("showStoryboard:"), forControlEvents: .TouchUpInside)
42+
_button.addTarget(self, action: #selector(showStoryboard(_:)), forControlEvents: .TouchUpInside)
4343
return _button
4444
}()
4545

@@ -125,7 +125,7 @@ class ExampleViewController: UITableViewController {
125125

126126
// MARK: - UIResponder Callbacks
127127

128-
@IBAction private func showStoryboard(sender: UIButton) {
128+
@objc private func showStoryboard(sender: UIButton) {
129129
if let controller = UIStoryboard(name: "Main", bundle: NSBundle.mainBundle()).instantiateInitialViewController() {
130130
controller.modalTransitionStyle = .FlipHorizontal
131131
presentViewController(controller, animated: true, completion: nil)

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Try <https://testflight.icook.tw>.
77
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
88
[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/ICInputAccessory.svg)](https://img.shields.io/cocoapods/v/ICInputAccessory.svg)
99
![Platform](https://img.shields.io/cocoapods/p/ICInputAccessory.svg?style=flat)
10-
![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg)
10+
![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg)
1111

1212
### ICKeyboardDismissTextField
1313

@@ -24,6 +24,11 @@ Try <https://testflight.icook.tw>.
2424

2525
## Requirements
2626

27+
ICInputAccessory | iOS | Xcode | Swift
28+
---------------- | :--: | :---: | -----
29+
v1.0.0 | 8.0+ | 7.2 | ![Swift 2.1.1](https://img.shields.io/badge/Swift-2.1.1-orange.svg)
30+
v1.1.0 | 8.0+ | 7.3 | ![Swift 2.2](https://img.shields.io/badge/Swift-2.2-orange.svg)
31+
2732
iOS 8.0+ with Xcode 7.2 or above.
2833

2934
## Installation

Source/KeyboardDismissTextField/ICKeyboardDismissTextField.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public class ICKeyboardDismissTextField: UITextField {
3232
@IBOutlet public var keyboardAccessoryView: ICKeyboardDismissAccessoryView! {
3333
didSet {
3434
if UI_USER_INTERFACE_IDIOM() != .Phone { return }
35-
keyboardAccessoryView.dismissButton.addTarget(self, action: Selector("dismiss:"), forControlEvents: .TouchUpInside)
35+
keyboardAccessoryView.dismissButton.addTarget(self, action: #selector(dismiss(_:)), forControlEvents: .TouchUpInside)
3636
inputAccessoryView = keyboardAccessoryView
3737
}
3838
}
@@ -58,6 +58,13 @@ public class ICKeyboardDismissTextField: UITextField {
5858
return super.becomeFirstResponder()
5959
}
6060

61+
@objc private func dismiss(sender: UIButton) {
62+
resignFirstResponder()
63+
UIView.animateWithDuration(0.3) {
64+
self.keyboardAccessoryView.alpha = 0
65+
}
66+
}
67+
6168
// MARK: - Private Methods
6269

6370
private func setUpAccessoryView() {
@@ -66,11 +73,4 @@ public class ICKeyboardDismissTextField: UITextField {
6673
}
6774
}
6875

69-
@IBAction private func dismiss(sender: UIButton) {
70-
resignFirstResponder()
71-
UIView.animateWithDuration(0.3) {
72-
self.keyboardAccessoryView.alpha = 0
73-
}
74-
}
75-
7676
}

Source/TokenField/ICTokenField.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
172172
_textField.returnKeyType = .Search
173173
_textField.delegate = self
174174
_textField.backspaceDelegate = self
175-
_textField.addTarget(self, action: Selector("togglePlaceholderIfNeeded:"), forControlEvents: .AllEditingEvents)
175+
_textField.addTarget(self, action: #selector(togglePlaceholderIfNeeded(_:)), forControlEvents: .AllEditingEvents)
176176
return _textField
177177
}()
178178

@@ -206,7 +206,7 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
206206
}()
207207

208208
private lazy var tapGestureRecognizer: UITapGestureRecognizer = {
209-
UITapGestureRecognizer(target: self, action: Selector("handleTapGesture:"))
209+
UITapGestureRecognizer(target: self, action: #selector(handleTapGesture(_:)))
210210
}()
211211

212212
// MARK: - Initialization
@@ -336,12 +336,12 @@ public class ICTokenField: UIView, UITextFieldDelegate, ICBackspaceTextFieldDele
336336

337337
// MARK: - UIResponder Callbacks
338338

339-
@IBAction private func togglePlaceholderIfNeeded(sender: UITextField? = nil) {
339+
@objc private func togglePlaceholderIfNeeded(sender: UITextField? = nil) {
340340
let showsPlaceholder = tokens.isEmpty && (inputTextField.text?.isEmpty ?? true)
341341
placeholderLabel.hidden = !showsPlaceholder
342342
}
343343

344-
@IBAction private func handleTapGesture(sender: UITapGestureRecognizer) {
344+
@objc private func handleTapGesture(sender: UITapGestureRecognizer) {
345345
if !isFirstResponder() {
346346
inputTextField.becomeFirstResponder()
347347
}

0 commit comments

Comments
 (0)