From 2e4812a5e7ec2cfe41d3fa812eb8a516e4cf1732 Mon Sep 17 00:00:00 2001 From: Anton Schukin Date: Fri, 15 Apr 2016 14:26:36 +0100 Subject: [PATCH] Fixed iOS 8 crash --- .../Source/ChatController/Collaborators/KeyboardTracker.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Chatto/Source/ChatController/Collaborators/KeyboardTracker.swift b/Chatto/Source/ChatController/Collaborators/KeyboardTracker.swift index 7c95fb0..1c322d7 100644 --- a/Chatto/Source/ChatController/Collaborators/KeyboardTracker.swift +++ b/Chatto/Source/ChatController/Collaborators/KeyboardTracker.swift @@ -125,6 +125,7 @@ class KeyboardTracker { return max(0, self.view.bounds.height - trackingViewRect.maxY) } + var ios8WorkaroundIsInProgress = false func layoutTrackingViewIfNeeded() { guard self.isTracking && self.keyboardStatus == .Shown else { return } self.adjustTrackingViewSizeIfNeeded() @@ -132,8 +133,11 @@ class KeyboardTracker { // Working fine on iOS 9 } else { // Workaround for iOS 8 + guard !self.ios8WorkaroundIsInProgress else { return } + self.ios8WorkaroundIsInProgress = true self.trackingView.window?.setNeedsLayout() self.trackingView.window?.layoutIfNeeded() + self.ios8WorkaroundIsInProgress = false } }