Skip to content

Commit 3916d73

Browse files
benasher44BasThomas
authored andcommitted
Update project for Swift 5 and Xcode 11 (#91)
* Update project for Swift 5 * update changelog
1 parent f82a510 commit 3916d73

5 files changed

Lines changed: 18 additions & 8 deletions

File tree

‎.travis.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
language: swift
2-
osx_image: xcode10.1
2+
osx_image: xcode11
33
script:
44
- xcodebuild clean test -project MessageViewController.xcodeproj -scheme MessageViewController -destination "platform=iOS Simulator,name=iPhone X,OS=11.3" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO -quiet

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## Added
44

5+
- **Breaking Change:** Requires Xcode 10.2+
6+
7+
- Upgraded to Swift 5 and added Swift 5 support to the podspec. [#91](https://github.com/GitHawkApp/MessageViewController/pull/91) by [@benasher44](https://github.com/benasher44)
8+
9+
# 0.2.0
10+
11+
## Added
12+
513
- **Breaking Change:** Migrated to Swift 4.2
614

715
- **Breaking Change:** Added a new delegate method to `MessageTextViewListener`, `func willChangeRange(textView: MessageTextView, to range: NSRange)` which allowed for the observation of text range changes such that the entire autocomplete string is deleted rather than character by character. [#15](https://github.com/GitHawkApp/MessageViewController/pull/15) by [@nathantannar4](https://github.com/nathantannar4)

‎MessageViewController.podspec‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@ Pod::Spec.new do |spec|
88
spec.source = { :git => 'https://github.com/GitHawkApp/MessageViewController.git', :tag => spec.version.to_s }
99
spec.source_files = 'MessageViewController/*.swift'
1010
spec.platform = :ios, '9.0'
11-
spec.swift_version = '4.2'
11+
if spec.respond_to?(:swift_versions) then
12+
spec.swift_versions = ['4.2', '5.0']
13+
else
14+
spec.swift_version = '4.2'
15+
end
1216
end

‎MessageViewController.xcodeproj/project.pbxproj‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@
339339
SDKROOT = iphoneos;
340340
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
341341
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
342+
SWIFT_VERSION = 5.0;
342343
VERSIONING_SYSTEM = "apple-generic";
343344
VERSION_INFO_PREFIX = "";
344345
};
@@ -393,6 +394,7 @@
393394
MTL_ENABLE_DEBUG_INFO = NO;
394395
SDKROOT = iphoneos;
395396
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
397+
SWIFT_VERSION = 5.0;
396398
VALIDATE_PRODUCT = YES;
397399
VERSIONING_SYSTEM = "apple-generic";
398400
VERSION_INFO_PREFIX = "";
@@ -417,7 +419,6 @@
417419
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
418420
SKIP_INSTALL = YES;
419421
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
420-
SWIFT_VERSION = 4.2;
421422
TARGETED_DEVICE_FAMILY = "1,2";
422423
};
423424
name = Debug;
@@ -439,7 +440,6 @@
439440
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.MessageViewController;
440441
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
441442
SKIP_INSTALL = YES;
442-
SWIFT_VERSION = 4.2;
443443
TARGETED_DEVICE_FAMILY = "1,2";
444444
};
445445
name = Release;
@@ -453,7 +453,6 @@
453453
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
454454
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.MessageViewControllerTests;
455455
PRODUCT_NAME = "$(TARGET_NAME)";
456-
SWIFT_VERSION = 4.2;
457456
TARGETED_DEVICE_FAMILY = "1,2";
458457
};
459458
name = Debug;
@@ -467,7 +466,6 @@
467466
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
468467
PRODUCT_BUNDLE_IDENTIFIER = com.whoisryannystrom.MessageViewControllerTests;
469468
PRODUCT_NAME = "$(TARGET_NAME)";
470-
SWIFT_VERSION = 4.2;
471469
TARGETED_DEVICE_FAMILY = "1,2";
472470
};
473471
name = Release;

‎MessageViewController/UITextView+Prefixes.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ internal extension UITextView {
2828
let result = text.word(at: caretRange)
2929
else { return nil }
3030

31-
let location = result.range.lowerBound.encodedOffset
32-
let range = NSRange(location: location, length: result.range.upperBound.encodedOffset - location)
31+
let location = result.range.lowerBound.utf16Offset(in: text)
32+
let range = NSRange(location: location, length: result.range.upperBound.utf16Offset(in: text) - location)
3333

3434
return (result.word, range)
3535
}

0 commit comments

Comments
 (0)