Skip to content

Commit 8f6e403

Browse files
committed
Support for Swift 4
1 parent d39b6ff commit 8f6e403

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

SelectableTextView.xcodeproj/project.pbxproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@
562562
PRODUCT_NAME = "$(TARGET_NAME)";
563563
SKIP_INSTALL = YES;
564564
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
565-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
565+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
566566
SWIFT_VERSION = 4.0;
567567
};
568568
name = Debug;
@@ -583,7 +583,7 @@
583583
PRODUCT_BUNDLE_IDENTIFIER = com.guaranteed.SelectableTextView;
584584
PRODUCT_NAME = "$(TARGET_NAME)";
585585
SKIP_INSTALL = YES;
586-
SWIFT_SWIFT3_OBJC_INFERENCE = On;
586+
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
587587
SWIFT_VERSION = 4.0;
588588
};
589589
name = Release;

Source/Extensions.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal extension Character {
3333
internal extension String {
3434

3535
var length: Int {
36-
return characters.count
36+
return count
3737
}
3838

3939
func truncate(leadingCharacters: Int) -> String {

Source/TextCellModelFactory.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ final internal class TextCellModelFactory {
3939
}
4040

4141
let text = attributedText.string
42-
guard text.characters.count > 0 else {
42+
guard text.count > 0 else {
4343
return textModels
4444
}
4545

4646
var characterCount: Int = 0
4747
var currentTextChunkStart = 0
4848
var currentTextChunkType = TextType.fromCharacter(character: text[text.startIndex])
49-
typealias _Index = String.CharacterView.Index
49+
typealias _Index = String.Index
5050

5151
func addModelAtIndex(index: _Index) {
5252
let currentTextChunkEnd = characterCount
@@ -80,7 +80,7 @@ final internal class TextCellModelFactory {
8080
currentTextChunkStart = currentTextChunkEnd
8181
}
8282

83-
for index in text.characters.indices {
83+
for index in text.indices {
8484
let currentCharacterTextType = TextType.fromCharacter(character: text[index])
8585
if currentTextChunkType != currentCharacterTextType {
8686
addModelAtIndex(index: index)

Source/TextSelectionValidator/RegexValidators.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fileprivate final class Regex {
1919
}
2020

2121
func test(input: String) -> Bool {
22-
let matches = self.internalExpression.matches(in: input, options: [], range: NSMakeRange(0, input.characters.count))
22+
let matches = self.internalExpression.matches(in: input, options: [], range: NSMakeRange(0, input.count))
2323
return matches.count > 0
2424
}
2525
}

0 commit comments

Comments
 (0)