File tree Expand file tree Collapse file tree 1 file changed +6
-13
lines changed
bk2ch10p526textFieldDelegate/ch23p810textFieldDelegate Expand file tree Collapse file tree 1 file changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -18,24 +18,17 @@ class MyTextField: UITextField {
1818
1919
2020 override func canPerformAction( action: Selector , withSender sender: AnyObject ? ) -> Bool {
21- if action == " expand: " {
22- if let r = self . selectedTextRange {
23- if let s = self . textInRange ( r) {
24- return s. characters. count == 2
25- && self . stateForAbbrev ( s) != nil
26- }
27- }
21+ if action == " expand: " , let r = self . selectedTextRange,
22+ let s = self . textInRange ( r) {
23+ return s. characters. count == 2 && self . stateForAbbrev ( s) != nil
2824 }
2925 return super. canPerformAction ( action, withSender: sender)
3026 }
3127
3228 func expand( sender: AnyObject ? ) {
33- if let r = self . selectedTextRange {
34- if let s = self . textInRange ( r) {
35- if let ss = self . stateForAbbrev ( s) {
36- self . replaceRange ( r, withText: ss)
37- }
38- }
29+ if let r = self . selectedTextRange, let s = self . textInRange ( r) ,
30+ let ss = self . stateForAbbrev ( s) {
31+ self . replaceRange ( r, withText: ss)
3932 }
4033 }
4134
You can’t perform that action at this time.
0 commit comments