diff --git a/.github/workflows/ci_pr_example.yml b/.github/workflows/ci_pr_example.yml
index 8ab262a5..dbeb0922 100644
--- a/.github/workflows/ci_pr_example.yml
+++ b/.github/workflows/ci_pr_example.yml
@@ -12,7 +12,7 @@ jobs:
- name: Cache Pods
uses: actions/cache@v1
with:
- path: Pods
+ path: Example/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Example/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
diff --git a/.swift-version b/.swift-version
deleted file mode 100644
index 819e07a2..00000000
--- a/.swift-version
+++ /dev/null
@@ -1 +0,0 @@
-5.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 401c583c..04674e4f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,8 @@ The changelog for `MessageKit`. Also see the [releases](https://github.com/Messa
### Changed
+- **Breaking Change** Dropped support for iOS 9 and iOS 10 [#1261](https://github.com/MessageKit/MessageKit/pull/1261) by [@kaspik](https://github.com/kaspik)
+
## 3.1.0
### Fixed
diff --git a/Example/ChatExample.xcodeproj/project.pbxproj b/Example/ChatExample.xcodeproj/project.pbxproj
index b205360d..dacdddf3 100644
--- a/Example/ChatExample.xcodeproj/project.pbxproj
+++ b/Example/ChatExample.xcodeproj/project.pbxproj
@@ -647,7 +647,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -699,7 +699,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
diff --git a/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme b/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme
index 31f17b89..fec5e125 100644
--- a/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme
+++ b/Example/ChatExample.xcodeproj/xcshareddata/xcschemes/ChatExample.xcscheme
@@ -1,6 +1,6 @@
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ codeCoverageEnabled = "YES">
+
+
+
+
@@ -54,17 +63,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
'Assets/MessageKitAssets.bundle/Images' }
s.dependency 'InputBarAccessoryView', '~> 4.3.0'
diff --git a/MessageKit.xcodeproj/project.pbxproj b/MessageKit.xcodeproj/project.pbxproj
index 72509f16..f057f989 100644
--- a/MessageKit.xcodeproj/project.pbxproj
+++ b/MessageKit.xcodeproj/project.pbxproj
@@ -783,7 +783,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -838,7 +838,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_VERSION = 5.0;
@@ -865,7 +865,6 @@
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -891,7 +890,6 @@
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
PRODUCT_NAME = "$(TARGET_NAME)";
diff --git a/README.md b/README.md
index 425ff0c9..5a4f0104 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
[](https://circleci.com/gh/MessageKit/MessageKit)
-[](https://codecov.io/gh/MessageKit/MessageKit)
+[](https://codecov.io/gh/MessageKit/MessageKit)
[](https://github.com/Carthage/Carthage)
diff --git a/Sources/Controllers/MessagesViewController+Keyboard.swift b/Sources/Controllers/MessagesViewController+Keyboard.swift
index 2abbd030..816a9ad1 100644
--- a/Sources/Controllers/MessagesViewController+Keyboard.swift
+++ b/Sources/Controllers/MessagesViewController+Keyboard.swift
@@ -32,7 +32,6 @@ internal extension MessagesViewController {
func addKeyboardObservers() {
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleKeyboardDidChangeState(_:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleTextViewDidBeginEditing(_:)), name: UITextView.textDidBeginEditingNotification, object: nil)
- NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.adjustScrollViewTopInset), name: UIDevice.orientationDidChangeNotification, object: nil)
}
func removeKeyboardObservers() {
@@ -105,19 +104,6 @@ internal extension MessagesViewController {
// MARK: - Inset Computation
- @objc
- func adjustScrollViewTopInset() {
- if #available(iOS 11.0, *) {
- // No need to add to the top contentInset
- } else {
- let navigationBarInset = navigationController?.navigationBar.frame.height ?? 0
- let statusBarInset: CGFloat = UIApplication.shared.isStatusBarHidden ? 0 : 20
- let topInset = navigationBarInset + statusBarInset
- messagesCollectionView.contentInset.top = topInset
- messagesCollectionView.scrollIndicatorInsets.top = topInset
- }
- }
-
private func requiredScrollViewBottomInset(forKeyboardFrame keyboardFrame: CGRect) -> CGFloat {
// we only need to adjust for the part of the keyboard that covers (i.e. intersects) our collection view;
// see https://developer.apple.com/videos/play/wwdc2017/242/ for more details
@@ -137,16 +123,12 @@ internal extension MessagesViewController {
return max(0, inputAccessoryViewHeight + additionalBottomInset - automaticallyAddedBottomInset)
}
- /// iOS 11's UIScrollView can automatically add safe area insets to its contentInset,
+ /// UIScrollView can automatically add safe area insets to its contentInset,
/// which needs to be accounted for when setting the contentInset based on screen coordinates.
///
/// - Returns: The distance automatically added to contentInset.bottom, if any.
private var automaticallyAddedBottomInset: CGFloat {
- if #available(iOS 11.0, *) {
- return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
- } else {
- return 0
- }
+ return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
}
}
diff --git a/Sources/Controllers/MessagesViewController.swift b/Sources/Controllers/MessagesViewController.swift
index e74b0183..522997ed 100644
--- a/Sources/Controllers/MessagesViewController.swift
+++ b/Sources/Controllers/MessagesViewController.swift
@@ -130,13 +130,10 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
addKeyboardObservers()
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
}
- adjustScrollViewTopInset()
}
open override func viewSafeAreaInsetsDidChange() {
- if #available(iOS 11.0, *) {
- super.viewSafeAreaInsetsDidChange()
- }
+ super.viewSafeAreaInsetsDidChange()
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
}
@@ -153,8 +150,8 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
private func setupDefaults() {
extendedLayoutIncludesOpaqueBars = true
- automaticallyAdjustsScrollViewInsets = false
view.backgroundColor = .backgroundColor
+ messagesCollectionView.contentInsetAdjustmentBehavior = .never
messagesCollectionView.keyboardDismissMode = .interactive
messagesCollectionView.alwaysBounceVertical = true
messagesCollectionView.backgroundColor = .backgroundColor
@@ -172,17 +169,11 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
private func setupConstraints() {
messagesCollectionView.translatesAutoresizingMaskIntoConstraints = false
- let top = messagesCollectionView.topAnchor.constraint(equalTo: view.topAnchor, constant: topLayoutGuide.length)
+ let top = messagesCollectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)
let bottom = messagesCollectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
- if #available(iOS 11.0, *) {
- let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
- let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
- NSLayoutConstraint.activate([top, bottom, trailing, leading])
- } else {
- let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor)
- let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
- NSLayoutConstraint.activate([top, bottom, trailing, leading])
- }
+ let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
+ let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
+ NSLayoutConstraint.activate([top, bottom, trailing, leading])
}
// MARK: - Typing Indicator API
diff --git a/Tests/ControllersTest/MessagesViewControllerSpec.swift b/Tests/ControllersTest/MessagesViewControllerSpec.swift
index 5717fb32..e33d4a76 100644
--- a/Tests/ControllersTest/MessagesViewControllerSpec.swift
+++ b/Tests/ControllersTest/MessagesViewControllerSpec.swift
@@ -63,9 +63,6 @@ final class MessagesViewControllerSpec: QuickSpec {
beforeEach {
controller.view.layoutIfNeeded()
}
- it("sets automaticallyAdjustsScrollViewInsets to false") {
- expect(controller.automaticallyAdjustsScrollViewInsets).to(beFalse())
- }
it("sets extendedLayoutIncludesOpaqueBars to true") {
expect(controller.extendedLayoutIncludesOpaqueBars).to(beTrue())
}