diff --git a/GrowingTextViewHandler.xcodeproj/project.pbxproj b/GrowingTextViewHandler.xcodeproj/project.pbxproj index a1f987c..cd183a6 100644 --- a/GrowingTextViewHandler.xcodeproj/project.pbxproj +++ b/GrowingTextViewHandler.xcodeproj/project.pbxproj @@ -426,6 +426,7 @@ ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -464,6 +465,7 @@ MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -480,7 +482,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -494,7 +496,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "com.hsusmita.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -558,7 +560,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -587,7 +589,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.GrowingTextViewHandler; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; - SWIFT_VERSION = 3.0.1; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/GrowingTextViewHandler/Base.lproj/Main.storyboard b/GrowingTextViewHandler/Base.lproj/Main.storyboard index 439549e..89e65e3 100644 --- a/GrowingTextViewHandler/Base.lproj/Main.storyboard +++ b/GrowingTextViewHandler/Base.lproj/Main.storyboard @@ -1,11 +1,8 @@ - - - - + - + @@ -18,50 +15,40 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + - - - - - - - - - + + @@ -77,22 +64,20 @@ - + - - + - + - diff --git a/GrowingTextViewHandler/Info.plist b/GrowingTextViewHandler/Info.plist index fbe1e6b..9be5795 100644 --- a/GrowingTextViewHandler/Info.plist +++ b/GrowingTextViewHandler/Info.plist @@ -20,5 +20,7 @@ $(CURRENT_PROJECT_VERSION) NSPrincipalClass + UIMainStoryboardFile + Main diff --git a/GrowingTextViewHandler/Source/GrowingTextViewHandler.swift b/GrowingTextViewHandler/Source/GrowingTextViewHandler.swift index f26791c..b82390a 100644 --- a/GrowingTextViewHandler/Source/GrowingTextViewHandler.swift +++ b/GrowingTextViewHandler/Source/GrowingTextViewHandler.swift @@ -23,7 +23,7 @@ open class GrowingTextViewHandler: NSObject { } private var textViewHeightConstraint: NSLayoutConstraint? - + /** The minumum height of the textView */ @@ -79,6 +79,7 @@ open class GrowingTextViewHandler: NSObject { super.init() growingTextView = textView textViewHeightConstraint = heightConstraint + initialHeight = heightConstraint.constant updateInitialHeightAndResize() } /** @@ -144,7 +145,7 @@ open class GrowingTextViewHandler: NSObject { private func estimatedInitialHeight() -> CGFloat { let totalHeight = caretHeight * CGFloat(minimumNumberOfLines) + growingTextView.textContainerInset.top + growingTextView.textContainerInset.bottom - return fmax(totalHeight, growingTextView.frame.height) + return fmax(totalHeight, initialHeight) } /**