From 542b238cce772d4a2140f6e4cb25a49335ac4acd Mon Sep 17 00:00:00 2001 From: Dhaval Thanki Date: Sat, 14 Oct 2017 14:19:21 +0530 Subject: [PATCH] iOS 11 crash resolved --- DTTextField.podspec | 2 +- DTTextField/Classes/DTTextField.swift | 4 +++- Example/DTTextField/DTTextField.swift | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/DTTextField.podspec b/DTTextField.podspec index dcd911a..9668568 100644 --- a/DTTextField.podspec +++ b/DTTextField.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = 'DTTextField' -s.version = '0.2.5' +s.version = '0.2.6' s.summary = 'DTTextField is UITextField library.' s.description = <<-DESC diff --git a/DTTextField/Classes/DTTextField.swift b/DTTextField/Classes/DTTextField.swift index 61abf6f..69e64ff 100644 --- a/DTTextField/Classes/DTTextField.swift +++ b/DTTextField/Classes/DTTextField.swift @@ -282,7 +282,9 @@ public class DTTextField: UITextField { fileprivate func insetRectForBounds(rect:CGRect) -> CGRect { - guard !lblFloatPlaceholder.text!.isEmptyStr else { return insetRectForEmptyBounds(rect: rect) } + guard let placeholderText = lblFloatPlaceholder.text,!placeholderText.isEmptyStr else { + return insetRectForEmptyBounds(rect: rect) + } if floatingDisplayStatus == .never { return insetRectForEmptyBounds(rect: rect) diff --git a/Example/DTTextField/DTTextField.swift b/Example/DTTextField/DTTextField.swift index 61abf6f..69e64ff 100644 --- a/Example/DTTextField/DTTextField.swift +++ b/Example/DTTextField/DTTextField.swift @@ -282,7 +282,9 @@ public class DTTextField: UITextField { fileprivate func insetRectForBounds(rect:CGRect) -> CGRect { - guard !lblFloatPlaceholder.text!.isEmptyStr else { return insetRectForEmptyBounds(rect: rect) } + guard let placeholderText = lblFloatPlaceholder.text,!placeholderText.isEmptyStr else { + return insetRectForEmptyBounds(rect: rect) + } if floatingDisplayStatus == .never { return insetRectForEmptyBounds(rect: rect)