Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cd2f33cff6 | |||
| 0783b82094 | |||
| eab1bf4f68 | |||
| 2083565137 | |||
| a37abe3ca4 | |||
| a59e433f3f | |||
| 02fe671728 | |||
| 28f9fab420 | |||
| bf8036ccf0 | |||
| 1dfd86ba3b | |||
| cfaf5ea7ce | |||
| 0ff12c3e50 |
+5
-5
@@ -9,7 +9,7 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
s.name = 'DTTextField'
|
||||
s.version = '0.3.0'
|
||||
s.version = '0.7.0'
|
||||
s.summary = 'DTTextField is UITextField library.'
|
||||
|
||||
s.description = <<-DESC
|
||||
@@ -18,12 +18,12 @@ DTTextField is UITextField library with floating and error label.
|
||||
|
||||
s.homepage = 'https://github.com/iDhaval/DTTextField'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'Dhaval Thanki' => 'dhaval.thanki@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/iDhaval/DTTextField.git', :tag => s.version.to_s }
|
||||
s.author = { 'Dhaval Thanki' => 'dhavaldthanki@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/iDhaval/DTTextField.git', :tag => s.version }
|
||||
|
||||
s.ios.deployment_target = '9.0'
|
||||
|
||||
s.source_files = 'DTTextField/Classes/*.{swift}'
|
||||
s.swift_version = '5.0'
|
||||
s.source_files = 'Sources/DTTextField/**/*'
|
||||
s.frameworks = 'UIKit'
|
||||
|
||||
end
|
||||
|
||||
@@ -0,0 +1,366 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0E6BCA66279D30400067A19F /* DTTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E6BCA65279D30400067A19F /* DTTextField.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
0E6BCB51279D41F00067A19F /* DTTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E6BCB50279D41F00067A19F /* DTTextField.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0E6BCA62279D30400067A19F /* DTTextField.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = DTTextField.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
0E6BCA65279D30400067A19F /* DTTextField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DTTextField.h; sourceTree = "<group>"; };
|
||||
0E6BCB50279D41F00067A19F /* DTTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DTTextField.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
0E6BCA5F279D30400067A19F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0E6BCA58279D30400067A19F = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCB4E279D41F00067A19F /* Sources */,
|
||||
0E6BCA64279D30400067A19F /* DTTextField */,
|
||||
0E6BCA63279D30400067A19F /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E6BCA63279D30400067A19F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCA62279D30400067A19F /* DTTextField.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E6BCA64279D30400067A19F /* DTTextField */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCA65279D30400067A19F /* DTTextField.h */,
|
||||
);
|
||||
path = DTTextField;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E6BCB4E279D41F00067A19F /* Sources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCB4F279D41F00067A19F /* DTTextField */,
|
||||
);
|
||||
path = Sources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E6BCB4F279D41F00067A19F /* DTTextField */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCB50279D41F00067A19F /* DTTextField.swift */,
|
||||
);
|
||||
path = DTTextField;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
0E6BCA5D279D30400067A19F /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0E6BCA66279D30400067A19F /* DTTextField.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
0E6BCA61279D30400067A19F /* DTTextField */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 0E6BCA69279D30400067A19F /* Build configuration list for PBXNativeTarget "DTTextField" */;
|
||||
buildPhases = (
|
||||
0E6BCA5D279D30400067A19F /* Headers */,
|
||||
0E6BCA5E279D30400067A19F /* Sources */,
|
||||
0E6BCA5F279D30400067A19F /* Frameworks */,
|
||||
0E6BCA60279D30400067A19F /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = DTTextField;
|
||||
productName = DTTextField;
|
||||
productReference = 0E6BCA62279D30400067A19F /* DTTextField.framework */;
|
||||
productType = "com.apple.product-type.framework";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
0E6BCA59279D30400067A19F /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastUpgradeCheck = 1320;
|
||||
TargetAttributes = {
|
||||
0E6BCA61279D30400067A19F = {
|
||||
CreatedOnToolsVersion = 13.2.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 0E6BCA5C279D30400067A19F /* Build configuration list for PBXProject "DTTextField" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 0E6BCA58279D30400067A19F;
|
||||
productRefGroup = 0E6BCA63279D30400067A19F /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
0E6BCA61279D30400067A19F /* DTTextField */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
0E6BCA60279D30400067A19F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0E6BCA5E279D30400067A19F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0E6BCB51279D41F00067A19F /* DTTextField.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
0E6BCA67279D30400067A19F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0E6BCA68279D30400067A19F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.2;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
VERSIONING_SYSTEM = "apple-generic";
|
||||
VERSION_INFO_PREFIX = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
0E6BCA6A279D30400067A19F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = XDZ4VN9T5R;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.dhaval.DTTextField;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
0E6BCA6B279D30400067A19F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = XDZ4VN9T5R;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.dhaval.DTTextField;
|
||||
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
|
||||
SKIP_INSTALL = YES;
|
||||
SUPPORTS_MACCATALYST = NO;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
0E6BCA5C279D30400067A19F /* Build configuration list for PBXProject "DTTextField" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0E6BCA67279D30400067A19F /* Debug */,
|
||||
0E6BCA68279D30400067A19F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
0E6BCA69279D30400067A19F /* Build configuration list for PBXNativeTarget "DTTextField" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
0E6BCA6A279D30400067A19F /* Debug */,
|
||||
0E6BCA6B279D30400067A19F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 0E6BCA59279D30400067A19F /* Project object */;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@@ -1,470 +0,0 @@
|
||||
//
|
||||
// DTTextField.swift
|
||||
// Pods
|
||||
//
|
||||
// Created by Dhaval Thanki on 03/04/17.
|
||||
//
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
public extension String {
|
||||
|
||||
var isEmptyStr:Bool{
|
||||
return self.trimmingCharacters(in: NSCharacterSet.whitespaces).isEmpty
|
||||
}
|
||||
}
|
||||
|
||||
public class DTTextField: UITextField {
|
||||
|
||||
public enum FloatingDisplayStatus{
|
||||
case always
|
||||
case never
|
||||
case defaults
|
||||
}
|
||||
|
||||
public enum DTBorderStyle{
|
||||
case none
|
||||
case rounded
|
||||
case sqare
|
||||
}
|
||||
|
||||
fileprivate var lblFloatPlaceholder:UILabel = UILabel()
|
||||
fileprivate var lblError:UILabel = UILabel()
|
||||
|
||||
fileprivate let paddingX:CGFloat = 5.0
|
||||
|
||||
fileprivate let paddingHeight:CGFloat = 10.0
|
||||
|
||||
public var dtLayer:CALayer = CALayer()
|
||||
public var floatPlaceholderColor:UIColor = UIColor.black
|
||||
public var floatPlaceholderActiveColor:UIColor = UIColor.black
|
||||
public var floatingLabelShowAnimationDuration = 0.3
|
||||
public var floatingDisplayStatus:FloatingDisplayStatus = .defaults
|
||||
|
||||
public var dtborderStyle:DTBorderStyle = .rounded{
|
||||
didSet{
|
||||
switch dtborderStyle {
|
||||
case .none:
|
||||
dtLayer.cornerRadius = 0.0
|
||||
dtLayer.borderWidth = 0.0
|
||||
case .rounded:
|
||||
dtLayer.cornerRadius = 4.5
|
||||
dtLayer.borderWidth = 0.5
|
||||
dtLayer.borderColor = borderColor.cgColor
|
||||
case .sqare:
|
||||
dtLayer.cornerRadius = 0.0
|
||||
dtLayer.borderWidth = 0.5
|
||||
dtLayer.borderColor = borderColor.cgColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var errorMessage:String = ""{
|
||||
didSet{ lblError.text = errorMessage }
|
||||
}
|
||||
|
||||
public var animateFloatPlaceholder:Bool = true
|
||||
public var hideErrorWhenEditing:Bool = true
|
||||
|
||||
public var errorFont = UIFont.systemFont(ofSize: 10.0){
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
}
|
||||
|
||||
public var floatPlaceholderFont = UIFont.systemFont(ofSize: 10.0){
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
}
|
||||
|
||||
public var paddingYFloatLabel:CGFloat = 3.0{
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
}
|
||||
|
||||
public var paddingYErrorLabel:CGFloat = 3.0{
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
}
|
||||
|
||||
public var borderColor:UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0){
|
||||
didSet{ dtLayer.borderColor = borderColor.cgColor }
|
||||
}
|
||||
|
||||
public var canShowBorder:Bool = true{
|
||||
didSet{ dtLayer.isHidden = !canShowBorder }
|
||||
}
|
||||
|
||||
public var placeholderColor:UIColor?{
|
||||
didSet{
|
||||
guard let color = placeholderColor else { return }
|
||||
attributedPlaceholder = NSAttributedString(string: placeholderFinal,
|
||||
attributes: [NSAttributedStringKey.foregroundColor:color])
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate var x:CGFloat {
|
||||
|
||||
if let leftView = leftView {
|
||||
return leftView.frame.origin.x + leftView.bounds.size.width - paddingX
|
||||
}
|
||||
|
||||
return paddingX
|
||||
}
|
||||
|
||||
fileprivate var fontHeight:CGFloat{
|
||||
return ceil(font!.lineHeight)
|
||||
}
|
||||
|
||||
fileprivate var dtLayerHeight:CGFloat{
|
||||
return showErrorLabel ? floor(bounds.height - lblError.bounds.size.height - paddingYErrorLabel) : bounds.height
|
||||
}
|
||||
|
||||
fileprivate var floatLabelWidth:CGFloat{
|
||||
|
||||
var width = bounds.size.width
|
||||
|
||||
if let leftViewWidth = leftView?.bounds.size.width{
|
||||
width -= leftViewWidth
|
||||
}
|
||||
|
||||
if let rightViewWidth = rightView?.bounds.size.width {
|
||||
width -= rightViewWidth
|
||||
}
|
||||
|
||||
return width - (self.x * 2)
|
||||
}
|
||||
|
||||
fileprivate var placeholderFinal:String{
|
||||
if let attributed = attributedPlaceholder { return attributed.string }
|
||||
return placeholder ?? " "
|
||||
}
|
||||
|
||||
fileprivate var isFloatLabelShowing:Bool = false
|
||||
|
||||
fileprivate var showErrorLabel:Bool = false{
|
||||
didSet{
|
||||
|
||||
guard showErrorLabel != oldValue else { return }
|
||||
|
||||
guard showErrorLabel else {
|
||||
hideErrorMessage()
|
||||
return
|
||||
}
|
||||
|
||||
guard !errorMessage.isEmptyStr else { return }
|
||||
showErrorMessage()
|
||||
}
|
||||
}
|
||||
|
||||
override public var borderStyle: UITextBorderStyle{
|
||||
didSet{
|
||||
guard borderStyle != oldValue else { return }
|
||||
borderStyle = .none
|
||||
}
|
||||
}
|
||||
|
||||
public override var textAlignment: NSTextAlignment{
|
||||
didSet{ setNeedsLayout() }
|
||||
}
|
||||
|
||||
public override var text: String?{
|
||||
didSet{ self.textFieldTextChanged() }
|
||||
}
|
||||
|
||||
override public var placeholder: String?{
|
||||
didSet{
|
||||
|
||||
guard let color = placeholderColor else {
|
||||
lblFloatPlaceholder.text = placeholderFinal
|
||||
return
|
||||
}
|
||||
attributedPlaceholder = NSAttributedString(string: placeholderFinal,
|
||||
attributes: [NSAttributedStringKey.foregroundColor:color])
|
||||
}
|
||||
}
|
||||
|
||||
override public var attributedPlaceholder: NSAttributedString?{
|
||||
didSet{ lblFloatPlaceholder.text = placeholderFinal }
|
||||
}
|
||||
|
||||
override public init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
commonInit()
|
||||
}
|
||||
|
||||
public func showError(message:String? = nil) {
|
||||
if let msg = message { errorMessage = msg }
|
||||
showErrorLabel = true
|
||||
}
|
||||
|
||||
public func hideError() {
|
||||
showErrorLabel = false
|
||||
}
|
||||
|
||||
|
||||
fileprivate func commonInit() {
|
||||
|
||||
dtborderStyle = .rounded
|
||||
dtLayer.backgroundColor = UIColor.white.cgColor
|
||||
|
||||
floatPlaceholderColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0)
|
||||
floatPlaceholderActiveColor = tintColor
|
||||
lblFloatPlaceholder.frame = CGRect.zero
|
||||
lblFloatPlaceholder.alpha = 0.0
|
||||
lblFloatPlaceholder.font = floatPlaceholderFont
|
||||
lblFloatPlaceholder.text = placeholderFinal
|
||||
|
||||
addSubview(lblFloatPlaceholder)
|
||||
|
||||
lblError.frame = CGRect.zero
|
||||
lblError.font = errorFont
|
||||
lblError.textColor = UIColor.red
|
||||
lblError.numberOfLines = 0
|
||||
lblError.isHidden = true
|
||||
|
||||
addTarget(self, action: #selector(textFieldTextChanged), for: .editingChanged)
|
||||
|
||||
addSubview(lblError)
|
||||
|
||||
layer.insertSublayer(dtLayer, at: 0)
|
||||
}
|
||||
|
||||
fileprivate func showErrorMessage(){
|
||||
|
||||
lblError.text = errorMessage
|
||||
lblError.isHidden = false
|
||||
let boundWithPadding = CGSize(width: bounds.width - (paddingX * 2), height: bounds.height)
|
||||
lblError.frame = CGRect(x: paddingX, y: 0, width: boundWithPadding.width, height: boundWithPadding.height)
|
||||
lblError.sizeToFit()
|
||||
|
||||
invalidateIntrinsicContentSize()
|
||||
}
|
||||
|
||||
func setErrorLabelAlignment() {
|
||||
var newFrame = lblError.frame
|
||||
|
||||
if textAlignment == .right {
|
||||
newFrame.origin.x = bounds.width - paddingX - newFrame.size.width
|
||||
}else if textAlignment == .left{
|
||||
newFrame.origin.x = paddingX
|
||||
}else if textAlignment == .center{
|
||||
newFrame.origin.x = (bounds.width / 2.0) - (newFrame.size.width / 2.0)
|
||||
}else if textAlignment == .natural{
|
||||
|
||||
if UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .rightToLeft{
|
||||
newFrame.origin.x = bounds.width - paddingX - newFrame.size.width
|
||||
}
|
||||
}
|
||||
|
||||
lblError.frame = newFrame
|
||||
}
|
||||
|
||||
func setFloatLabelAlignment() {
|
||||
var newFrame = lblFloatPlaceholder.frame
|
||||
|
||||
if textAlignment == .right {
|
||||
newFrame.origin.x = bounds.width - paddingX - newFrame.size.width
|
||||
}else if textAlignment == .left{
|
||||
newFrame.origin.x = paddingX
|
||||
}else if textAlignment == .center{
|
||||
newFrame.origin.x = (bounds.width / 2.0) - (newFrame.size.width / 2.0)
|
||||
}else if textAlignment == .natural{
|
||||
|
||||
if UIView.userInterfaceLayoutDirection(for: semanticContentAttribute) == .rightToLeft{
|
||||
newFrame.origin.x = bounds.width - paddingX - newFrame.size.width
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
lblFloatPlaceholder.frame = newFrame
|
||||
}
|
||||
|
||||
fileprivate func hideErrorMessage(){
|
||||
lblError.text = ""
|
||||
lblError.isHidden = true
|
||||
lblError.frame = CGRect.zero
|
||||
invalidateIntrinsicContentSize()
|
||||
}
|
||||
|
||||
fileprivate func showFloatingLabel(_ animated:Bool) {
|
||||
|
||||
let animations:(()->()) = {
|
||||
self.lblFloatPlaceholder.alpha = 1.0
|
||||
self.lblFloatPlaceholder.frame = CGRect(x: self.lblFloatPlaceholder.frame.origin.x,
|
||||
y: self.paddingYFloatLabel,
|
||||
width: self.lblFloatPlaceholder.bounds.size.width,
|
||||
height: self.lblFloatPlaceholder.bounds.size.height)
|
||||
}
|
||||
|
||||
if animated && animateFloatPlaceholder {
|
||||
UIView.animate(withDuration: floatingLabelShowAnimationDuration,
|
||||
delay: 0.0,
|
||||
options: [.beginFromCurrentState,.curveEaseOut],
|
||||
animations: animations){ status in
|
||||
DispatchQueue.main.async {
|
||||
self.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
animations()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func hideFlotingLabel(_ animated:Bool) {
|
||||
|
||||
let animations:(()->()) = {
|
||||
self.lblFloatPlaceholder.alpha = 0.0
|
||||
self.lblFloatPlaceholder.frame = CGRect(x: self.lblFloatPlaceholder.frame.origin.x,
|
||||
y: self.lblFloatPlaceholder.font.lineHeight,
|
||||
width: self.lblFloatPlaceholder.bounds.size.width,
|
||||
height: self.lblFloatPlaceholder.bounds.size.height)
|
||||
}
|
||||
|
||||
if animated && animateFloatPlaceholder {
|
||||
UIView.animate(withDuration: floatingLabelShowAnimationDuration,
|
||||
delay: 0.0,
|
||||
options: [.beginFromCurrentState,.curveEaseOut],
|
||||
animations: animations){ status in
|
||||
DispatchQueue.main.async {
|
||||
self.layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
}else{
|
||||
animations()
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func insetRectForEmptyBounds(rect:CGRect) -> CGRect{
|
||||
let newX = x
|
||||
guard showErrorLabel else { return CGRect(x: newX, y: 0, width: rect.width - newX - paddingX, height: rect.height) }
|
||||
|
||||
let topInset = (rect.size.height - lblError.bounds.size.height - paddingYErrorLabel - fontHeight) / 2.0
|
||||
let textY = topInset - ((rect.height - fontHeight) / 2.0)
|
||||
|
||||
return CGRect(x: newX, y: floor(textY), width: rect.size.width - newX - paddingX, height: rect.size.height)
|
||||
}
|
||||
|
||||
fileprivate func insetRectForBounds(rect:CGRect) -> CGRect {
|
||||
|
||||
guard let placeholderText = lblFloatPlaceholder.text,!placeholderText.isEmptyStr else {
|
||||
return insetRectForEmptyBounds(rect: rect)
|
||||
}
|
||||
|
||||
if floatingDisplayStatus == .never {
|
||||
return insetRectForEmptyBounds(rect: rect)
|
||||
}else{
|
||||
|
||||
if let text = text,text.isEmptyStr && floatingDisplayStatus == .defaults {
|
||||
return insetRectForEmptyBounds(rect: rect)
|
||||
}else{
|
||||
let topInset = paddingYFloatLabel + lblFloatPlaceholder.bounds.size.height + (paddingHeight / 2.0)
|
||||
let textOriginalY = (rect.height - fontHeight) / 2.0
|
||||
var textY = topInset - textOriginalY
|
||||
|
||||
if textY < 0 && !showErrorLabel { textY = topInset }
|
||||
let newX = x
|
||||
return CGRect(x: newX, y: ceil(textY), width: rect.size.width - newX - paddingX, height: rect.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@objc fileprivate func textFieldTextChanged(){
|
||||
guard hideErrorWhenEditing && showErrorLabel else { return }
|
||||
showErrorLabel = false
|
||||
}
|
||||
|
||||
override public var intrinsicContentSize: CGSize{
|
||||
self.layoutIfNeeded()
|
||||
|
||||
let textFieldIntrinsicContentSize = super.intrinsicContentSize
|
||||
|
||||
if showErrorLabel {
|
||||
lblFloatPlaceholder.sizeToFit()
|
||||
return CGSize(width: textFieldIntrinsicContentSize.width,
|
||||
height: textFieldIntrinsicContentSize.height + paddingYFloatLabel + paddingYErrorLabel + lblFloatPlaceholder.bounds.size.height + lblError.bounds.size.height + paddingHeight)
|
||||
}else{
|
||||
return CGSize(width: textFieldIntrinsicContentSize.width,
|
||||
height: textFieldIntrinsicContentSize.height + paddingYFloatLabel + lblFloatPlaceholder.bounds.size.height + paddingHeight)
|
||||
}
|
||||
}
|
||||
|
||||
override public func textRect(forBounds bounds: CGRect) -> CGRect {
|
||||
let rect = super.textRect(forBounds: bounds)
|
||||
return insetRectForBounds(rect: rect)
|
||||
}
|
||||
|
||||
override public func editingRect(forBounds bounds: CGRect) -> CGRect {
|
||||
let rect = super.editingRect(forBounds: bounds)
|
||||
return insetRectForBounds(rect: rect)
|
||||
}
|
||||
|
||||
fileprivate func insetForSideView(forBounds bounds: CGRect) -> CGRect{
|
||||
var rect = bounds
|
||||
rect.origin.y = 0
|
||||
rect.size.height = dtLayerHeight
|
||||
return rect
|
||||
}
|
||||
|
||||
override public func leftViewRect(forBounds bounds: CGRect) -> CGRect {
|
||||
let rect = super.leftViewRect(forBounds: bounds)
|
||||
return insetForSideView(forBounds: rect)
|
||||
}
|
||||
|
||||
override public func rightViewRect(forBounds bounds: CGRect) -> CGRect {
|
||||
let rect = super.rightViewRect(forBounds: bounds)
|
||||
return insetForSideView(forBounds: rect)
|
||||
}
|
||||
|
||||
override public func clearButtonRect(forBounds bounds: CGRect) -> CGRect {
|
||||
var rect = super.clearButtonRect(forBounds: bounds)
|
||||
rect.origin.y = (dtLayerHeight - rect.size.height) / 2
|
||||
return rect
|
||||
}
|
||||
|
||||
override public func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
|
||||
CATransaction.begin()
|
||||
CATransaction.setDisableActions(true)
|
||||
dtLayer.frame = CGRect(x: bounds.origin.x,
|
||||
y: bounds.origin.y,
|
||||
width: bounds.width,
|
||||
height: dtLayerHeight)
|
||||
CATransaction.commit()
|
||||
|
||||
if showErrorLabel {
|
||||
|
||||
var lblErrorFrame = lblError.frame
|
||||
lblErrorFrame.origin.y = dtLayer.frame.origin.y + dtLayer.frame.size.height + paddingYErrorLabel
|
||||
lblError.frame = lblErrorFrame
|
||||
}
|
||||
|
||||
let floatingLabelSize = lblFloatPlaceholder.sizeThatFits(lblFloatPlaceholder.superview!.bounds.size)
|
||||
|
||||
lblFloatPlaceholder.frame = CGRect(x: x, y: lblFloatPlaceholder.frame.origin.y,
|
||||
width: floatingLabelSize.width,
|
||||
height: floatingLabelSize.height)
|
||||
|
||||
setErrorLabelAlignment()
|
||||
setFloatLabelAlignment()
|
||||
lblFloatPlaceholder.textColor = isFirstResponder ? floatPlaceholderActiveColor : floatPlaceholderColor
|
||||
|
||||
switch floatingDisplayStatus {
|
||||
case .never:
|
||||
hideFlotingLabel(isFirstResponder)
|
||||
case .always:
|
||||
showFloatingLabel(isFirstResponder)
|
||||
default:
|
||||
if let enteredText = text,!enteredText.isEmptyStr{
|
||||
showFloatingLabel(isFirstResponder)
|
||||
}else{
|
||||
hideFlotingLabel(isFirstResponder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// DTTextField.h
|
||||
// DTTextField
|
||||
//
|
||||
// Created by Dhaval Thanki on 23/01/22.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
//! Project version number for DTTextField.
|
||||
FOUNDATION_EXPORT double DTTextFieldVersionNumber;
|
||||
|
||||
//! Project version string for DTTextField.
|
||||
FOUNDATION_EXPORT const unsigned char DTTextFieldVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <DTTextField/PublicHeader.h>
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objectVersion = 52;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
0E6BCA7B279D33D30067A19F /* DTTextField.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E6BCA79279D335B0067A19F /* DTTextField.framework */; platformFilter = ios; };
|
||||
0E6BCA7C279D33D30067A19F /* DTTextField.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 0E6BCA79279D335B0067A19F /* DTTextField.framework */; platformFilter = ios; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
0EBDB911205BD7EA001E212E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0EBDB90F205BD7EA001E212E /* Localizable.strings */; };
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
|
||||
@@ -14,10 +16,16 @@
|
||||
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
|
||||
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
|
||||
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
|
||||
F20EFAF71ED7136A00DE8008 /* DTTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = F20EFAF61ED7136A00DE8008 /* DTTextField.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
0E6BCA78279D335B0067A19F /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 0E6BCA74279D335B0067A19F /* DTTextField.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 0E6BCA62279D30400067A19F;
|
||||
remoteInfo = DTTextField;
|
||||
};
|
||||
607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 607FACC81AFB9204008FA782 /* Project object */;
|
||||
@@ -27,7 +35,22 @@
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
0E6BCA7D279D33D30067A19F /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
0E6BCA7C279D33D30067A19F /* DTTextField.framework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
0E6BCA74279D335B0067A19F /* DTTextField.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = DTTextField.xcodeproj; path = ../DTTextField.xcodeproj; sourceTree = "<group>"; };
|
||||
0EBDB903205BCB1C001E212E /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Main.strings; sourceTree = "<group>"; };
|
||||
0EBDB904205BCB1C001E212E /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
|
||||
0EBDB912205BD7EE001E212E /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
@@ -42,7 +65,6 @@
|
||||
607FACE51AFB9204008FA782 /* DTTextField_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DTTextField_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = "<group>"; };
|
||||
F20EFAF61ED7136A00DE8008 /* DTTextField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DTTextField.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -50,6 +72,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
0E6BCA7B279D33D30067A19F /* DTTextField.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -63,12 +86,29 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
0E6BCA75279D335B0067A19F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCA79279D335B0067A19F /* DTTextField.framework */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
0E6BCA7A279D33D30067A19F /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
607FACC71AFB9204008FA782 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0E6BCA74279D335B0067A19F /* DTTextField.xcodeproj */,
|
||||
607FACD21AFB9204008FA782 /* Example for DTTextField */,
|
||||
607FACE81AFB9204008FA782 /* Tests */,
|
||||
607FACD11AFB9204008FA782 /* Products */,
|
||||
0E6BCA7A279D33D30067A19F /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
@@ -85,7 +125,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
0EBDB90F205BD7EA001E212E /* Localizable.strings */,
|
||||
F20EFAF61ED7136A00DE8008 /* DTTextField.swift */,
|
||||
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
|
||||
607FACD71AFB9204008FA782 /* ViewController.swift */,
|
||||
607FACD91AFB9204008FA782 /* Main.storyboard */,
|
||||
@@ -132,6 +171,7 @@
|
||||
607FACCC1AFB9204008FA782 /* Sources */,
|
||||
607FACCD1AFB9204008FA782 /* Frameworks */,
|
||||
607FACCE1AFB9204008FA782 /* Resources */,
|
||||
0E6BCA7D279D33D30067A19F /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
@@ -187,6 +227,7 @@
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
English,
|
||||
en,
|
||||
Base,
|
||||
ar,
|
||||
@@ -194,6 +235,12 @@
|
||||
mainGroup = 607FACC71AFB9204008FA782;
|
||||
productRefGroup = 607FACD11AFB9204008FA782 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 0E6BCA75279D335B0067A19F /* Products */;
|
||||
ProjectRef = 0E6BCA74279D335B0067A19F /* DTTextField.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
607FACCF1AFB9204008FA782 /* DTTextField_Example */,
|
||||
@@ -202,6 +249,16 @@
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
0E6BCA79279D335B0067A19F /* DTTextField.framework */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = wrapper.framework;
|
||||
path = DTTextField.framework;
|
||||
remoteRef = 0E6BCA78279D335B0067A19F /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
607FACCE1AFB9204008FA782 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
@@ -228,7 +285,6 @@
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
F20EFAF71ED7136A00DE8008 /* DTTextField.swift in Sources */,
|
||||
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
|
||||
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
|
||||
);
|
||||
@@ -367,7 +423,8 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-O";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
@@ -379,11 +436,14 @@
|
||||
DEVELOPMENT_TEAM = XDZ4VN9T5R;
|
||||
INFOPLIST_FILE = DTTextField/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.DTTextField-Example1";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -394,11 +454,14 @@
|
||||
DEVELOPMENT_TEAM = XDZ4VN9T5R;
|
||||
INFOPLIST_FILE = DTTextField/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MODULE_NAME = ExampleApp;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.DTTextField-Example1";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -414,10 +477,14 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -429,10 +496,14 @@
|
||||
"$(inherited)",
|
||||
);
|
||||
INFOPLIST_FILE = Tests/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Kzc-T6-rcN">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Kzc-T6-rcN">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19519"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
@@ -22,65 +20,60 @@
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3qx-l3-jfU">
|
||||
<rect key="frame" x="0.0" y="64" width="375" height="603"/>
|
||||
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="T5N-VG-n0n">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="307"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
|
||||
<subviews>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="First Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LZk-sC-XSt" customClass="DTTextField" customModule="DTTextField_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="50" width="343" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="First Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="LZk-sC-XSt" customClass="DTTextField" customModule="DTTextField">
|
||||
<rect key="frame" x="16" y="50" width="343" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Last Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ZMK-KE-9Cc" customClass="DTTextField" customModule="DTTextField_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="88" width="343" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Last Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="ZMK-KE-9Cc" customClass="DTTextField" customModule="DTTextField">
|
||||
<rect key="frame" x="16" y="92" width="343" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vp4-XI-7k7">
|
||||
<rect key="frame" x="158.5" y="242" width="57" height="30"/>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vp4-XI-7k7">
|
||||
<rect key="frame" x="159" y="262" width="57" height="30"/>
|
||||
<state key="normal" title="Register"/>
|
||||
<connections>
|
||||
<action selector="onBtnSubmitClicked:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="vbi-gx-VFd"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="G8b-0H-NOp" customClass="DTTextField" customModule="DTTextField_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="126" width="343" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Email" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="G8b-0H-NOp" customClass="DTTextField" customModule="DTTextField">
|
||||
<rect key="frame" x="16" y="134" width="343" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vOV-P3-5my" customClass="DTTextField" customModule="DTTextField_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="164" width="343" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="vOV-P3-5my" customClass="DTTextField" customModule="DTTextField">
|
||||
<rect key="frame" x="16" y="176" width="343" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Confirm Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oVW-xu-ETH" customClass="DTTextField" customModule="DTTextField_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="202" width="343" height="30"/>
|
||||
<nil key="textColor"/>
|
||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Confirm Password" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="oVW-xu-ETH" customClass="DTTextField" customModule="DTTextField">
|
||||
<rect key="frame" x="16" y="218" width="343" height="34"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</textField>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="oVW-xu-ETH" firstAttribute="leading" secondItem="vOV-P3-5my" secondAttribute="leading" id="2Ox-na-6ZX"/>
|
||||
<constraint firstItem="oVW-xu-ETH" firstAttribute="trailing" secondItem="vOV-P3-5my" secondAttribute="trailing" id="2Eh-Ef-dQi"/>
|
||||
<constraint firstItem="oVW-xu-ETH" firstAttribute="leading" secondItem="vOV-P3-5my" secondAttribute="leading" id="2iy-n5-w9F"/>
|
||||
<constraint firstAttribute="trailing" secondItem="LZk-sC-XSt" secondAttribute="trailing" constant="16" id="7xF-Yy-7dc"/>
|
||||
<constraint firstItem="LZk-sC-XSt" firstAttribute="leading" secondItem="T5N-VG-n0n" secondAttribute="leading" constant="16" id="8fK-In-ELG"/>
|
||||
<constraint firstItem="G8b-0H-NOp" firstAttribute="top" secondItem="ZMK-KE-9Cc" secondAttribute="bottom" constant="8" id="9MY-nz-wjQ"/>
|
||||
<constraint firstItem="vOV-P3-5my" firstAttribute="trailing" secondItem="G8b-0H-NOp" secondAttribute="trailing" id="BZ6-is-x2y"/>
|
||||
<constraint firstItem="Vp4-XI-7k7" firstAttribute="top" secondItem="oVW-xu-ETH" secondAttribute="bottom" constant="10" id="Czg-UB-G6G"/>
|
||||
<constraint firstItem="oVW-xu-ETH" firstAttribute="trailing" secondItem="vOV-P3-5my" secondAttribute="trailing" id="FFZ-h7-nmL"/>
|
||||
<constraint firstItem="vOV-P3-5my" firstAttribute="leading" secondItem="G8b-0H-NOp" secondAttribute="leading" id="FlG-Yh-6D8"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Vp4-XI-7k7" secondAttribute="bottom" constant="35" id="HWJ-ke-SwV"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="Vp4-XI-7k7" secondAttribute="bottom" constant="35" id="HWJ-ke-SwV"/>
|
||||
<constraint firstItem="ZMK-KE-9Cc" firstAttribute="leading" secondItem="LZk-sC-XSt" secondAttribute="leading" id="Jzj-d1-Cuc"/>
|
||||
<constraint firstItem="G8b-0H-NOp" firstAttribute="leading" secondItem="ZMK-KE-9Cc" secondAttribute="leading" id="X9C-jl-FiE"/>
|
||||
<constraint firstItem="ZMK-KE-9Cc" firstAttribute="top" secondItem="LZk-sC-XSt" secondAttribute="bottom" constant="8" id="XKP-xw-pz9"/>
|
||||
<constraint firstItem="oVW-xu-ETH" firstAttribute="top" secondItem="vOV-P3-5my" secondAttribute="bottom" constant="8" id="eEv-lG-Ktc"/>
|
||||
<constraint firstItem="Vp4-XI-7k7" firstAttribute="centerX" secondItem="oVW-xu-ETH" secondAttribute="centerX" id="noc-qO-6TG"/>
|
||||
<constraint firstItem="Vp4-XI-7k7" firstAttribute="centerX" secondItem="T5N-VG-n0n" secondAttribute="centerX" id="ikl-qL-tO7"/>
|
||||
<constraint firstItem="G8b-0H-NOp" firstAttribute="trailing" secondItem="ZMK-KE-9Cc" secondAttribute="trailing" id="onN-5k-UBd"/>
|
||||
<constraint firstItem="LZk-sC-XSt" firstAttribute="top" secondItem="T5N-VG-n0n" secondAttribute="top" constant="50" id="pmI-vf-fOU"/>
|
||||
<constraint firstItem="ZMK-KE-9Cc" firstAttribute="trailing" secondItem="LZk-sC-XSt" secondAttribute="trailing" id="tZs-73-KYu"/>
|
||||
@@ -118,7 +111,7 @@
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="964" y="36.431784107946029"/>
|
||||
<point key="canvasLocation" x="554" y="46"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="sQ1-e3-OIZ">
|
||||
@@ -126,7 +119,7 @@
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Kzc-T6-rcN" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" id="rBs-ML-edK">
|
||||
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
@@ -136,7 +129,7 @@
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="qlg-7C-Sy0" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="122" y="36"/>
|
||||
<point key="canvasLocation" x="-194" y="47"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
@@ -2,47 +2,52 @@
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x"
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x"
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x"
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x"
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x"
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import DTTextField
|
||||
|
||||
class ViewController: UIViewController {
|
||||
|
||||
@@ -29,23 +30,18 @@ class ViewController: UIViewController {
|
||||
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
}
|
||||
|
||||
override func viewDidLayoutSubviews() {
|
||||
super.viewDidLayoutSubviews()
|
||||
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: .UIKeyboardWillShow, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: .UIKeyboardWillHide, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow(notification:)), name: UIResponder.keyboardWillShowNotification, object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide(notification:)), name: UIResponder.keyboardWillHideNotification, object: nil)
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillShow, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: .UIKeyboardWillHide, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
|
||||
NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
@@ -59,28 +55,28 @@ class ViewController: UIViewController {
|
||||
|
||||
let alert = UIAlertController(title: "Congratulations", message: "Your registration is successful!!!", preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .cancel, handler: { (cancel) in
|
||||
|
||||
DispatchQueue.main.async {
|
||||
self.txtFirstName.text = ""
|
||||
self.txtLastName.text = ""
|
||||
self.txtEmail.text = ""
|
||||
self.txtConfirmPassword.text = ""
|
||||
self.txtPassword.text = ""
|
||||
}
|
||||
DispatchQueue.main.async { self.clearForm() }
|
||||
}))
|
||||
|
||||
present(alert, animated: true, completion: nil)
|
||||
|
||||
}
|
||||
|
||||
|
||||
func clearForm() {
|
||||
self.txtFirstName.text = ""
|
||||
self.txtLastName.text = ""
|
||||
self.txtEmail.text = ""
|
||||
self.txtConfirmPassword.text = ""
|
||||
self.txtPassword.text = ""
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: User Define Methods
|
||||
extension ViewController{
|
||||
|
||||
@objc func keyboardWillShow(notification:Notification) {
|
||||
guard let keyboardHeight = (notification.userInfo?[UIKeyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue else { return }
|
||||
scrollView.contentInset = UIEdgeInsetsMake(0, 0, keyboardHeight.height, 0)
|
||||
guard let keyboardHeight = (notification.userInfo?[UIResponder.keyboardFrameBeginUserInfoKey] as? NSValue)?.cgRectValue else { return }
|
||||
scrollView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: keyboardHeight.height, right: 0)
|
||||
}
|
||||
|
||||
@objc func keyboardWillHide(notification:Notification) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import UIKit
|
||||
import XCTest
|
||||
import DTTextField
|
||||
|
||||
class Tests: XCTestCase {
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Copyright (c) 2017 dvl.thanki@gmail.com <dhaval@pixometryinfosoft.com>
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 Dhaval Thanki
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
// swift-tools-version:5.5
|
||||
// The swift-tools-version declares the minimum version of Swift required to build this package.
|
||||
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "DTTextField",
|
||||
platforms: [.iOS(.v9)],
|
||||
products: [
|
||||
// Products define the executables and libraries a package produces, and make them visible to other packages.
|
||||
.library(
|
||||
name: "DTTextField",
|
||||
targets: ["DTTextField"]),
|
||||
],
|
||||
dependencies: [
|
||||
// Dependencies declare other packages that this package depends on.
|
||||
// .package(url: /* package url */, from: "1.0.0"),
|
||||
],
|
||||
targets: [
|
||||
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
|
||||
// Targets can depend on other targets in this package, and on products in packages this package depends on.
|
||||
.target(
|
||||
name: "DTTextField",
|
||||
dependencies: []),
|
||||
],
|
||||
swiftLanguageVersions: [.v5]
|
||||
)
|
||||
@@ -1,10 +1,10 @@
|
||||
# DTTextField
|
||||
|
||||
[](https://github.com/iDhaval/DTTextField/releases/tag/0.2.4)
|
||||
[](https://github.com/iDhaval/DTTextField/releases/tag/0.7.0)
|
||||
[](https://github.com/iDhaval/DTTextField/blob/master/LICENSE)
|
||||
[](https://github.com/matteocrippa/awesome-swift)
|
||||
[](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/)
|
||||

|
||||
[](https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/)
|
||||

|
||||
|
||||

|
||||
|
||||
@@ -20,11 +20,13 @@ Clone the repo and run the example project from the Example directory.
|
||||
|
||||
## Requirements
|
||||
|
||||
* Xcode 8.0+
|
||||
* Swift 3.0+
|
||||
* Xcode 11.0+
|
||||
* Swift 5.0+
|
||||
|
||||
## Installation
|
||||
|
||||
### CocoaPods
|
||||
|
||||
DTTextField is available through [CocoaPods](http://cocoapods.org). To install
|
||||
it, simply add the following line to your Podfile:
|
||||
|
||||
@@ -32,6 +34,14 @@ it, simply add the following line to your Podfile:
|
||||
pod 'DTTextField'
|
||||
```
|
||||
|
||||
### Swift Package Manager
|
||||
|
||||
Click `File` -> `Add Packages...`, enter [DTTextField repo's URL](https://github.com/iDhaval/DTTextField).
|
||||
|
||||
```swift
|
||||
https://github.com/iDhaval/DTTextField
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
1. Open a storyboard or Xib file.
|
||||
@@ -44,6 +54,7 @@ pod 'DTTextField'
|
||||
| ------------- |------------- | ----- |
|
||||
| errorMessage | String | Add your error message to this property|
|
||||
| errorFont | UIFont | Change font of error text |
|
||||
| errorTextColor | UIColor | Change color of error text |
|
||||
| paddingYErrorLabel | CGFloat | Error text top padding |
|
||||
| floatPlaceholderColor | UIColor | To change float placeholder color |
|
||||
| floatPlaceholderActiveColor | UIColor | To change float placeholder color while TextField is active(First responder)|
|
||||
@@ -54,13 +65,15 @@ pod 'DTTextField'
|
||||
| hideErrorWhenEditing | Bool | hide error label when typing |
|
||||
| floatingDisplayStatus | enum | maintain display status always, never, defaults |
|
||||
|
||||
|
||||
### Important Properties
|
||||
|
||||
| Property name | Type | Remark |
|
||||
| ------------- |------------- | ----- |
|
||||
| dtLayer | CALayer | If you want to formate DTTextField than use dtLayer property instead of layer |
|
||||
| dtLayer | CALayer | If you want to formate DTTextField than use dtLayer property instead of layer (e.g. background color) |
|
||||
| borderColor | UIColor | Change border color of DTTextField |
|
||||
| canShowBorder | Bool | Toggle border of DTTextField |
|
||||
| dtborderStyle | enum | none, rounded , sqare , top , bottom , left , right |
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ public class DTTextField: UITextField {
|
||||
case none
|
||||
case rounded
|
||||
case sqare
|
||||
case top
|
||||
case bottom
|
||||
case left
|
||||
case right
|
||||
}
|
||||
|
||||
fileprivate var lblFloatPlaceholder:UILabel = UILabel()
|
||||
@@ -36,27 +40,48 @@ public class DTTextField: UITextField {
|
||||
fileprivate let paddingX:CGFloat = 5.0
|
||||
|
||||
fileprivate let paddingHeight:CGFloat = 10.0
|
||||
|
||||
fileprivate var borderLayer:CALayer = CALayer()
|
||||
public var dtLayer:CALayer = CALayer()
|
||||
public var floatPlaceholderColor:UIColor = UIColor.black
|
||||
public var floatPlaceholderActiveColor:UIColor = UIColor.black
|
||||
public var floatingLabelShowAnimationDuration = 0.3
|
||||
public var floatingDisplayStatus:FloatingDisplayStatus = .defaults
|
||||
public var borderWidth:CGFloat = 0.5{
|
||||
didSet{
|
||||
let borderStyle = dtborderStyle;
|
||||
dtborderStyle = borderStyle
|
||||
}
|
||||
}
|
||||
|
||||
public var dtborderStyle:DTBorderStyle = .rounded{
|
||||
didSet{
|
||||
borderLayer.removeFromSuperlayer()
|
||||
switch dtborderStyle {
|
||||
case .none:
|
||||
dtLayer.cornerRadius = 0.0
|
||||
dtLayer.borderWidth = 0.0
|
||||
case .rounded:
|
||||
dtLayer.cornerRadius = 4.5
|
||||
dtLayer.borderWidth = 0.5
|
||||
dtLayer.borderWidth = borderWidth
|
||||
dtLayer.borderColor = borderColor.cgColor
|
||||
case .sqare:
|
||||
dtLayer.cornerRadius = 0.0
|
||||
dtLayer.borderWidth = 0.5
|
||||
dtLayer.borderWidth = borderWidth
|
||||
dtLayer.borderColor = borderColor.cgColor
|
||||
case .bottom,.left,.right,.top:
|
||||
dtLayer.cornerRadius = 0.0
|
||||
dtLayer.borderWidth = 0.0
|
||||
borderLayer.backgroundColor = borderColor.cgColor
|
||||
if dtborderStyle == .bottom {
|
||||
borderLayer.frame = CGRect(x: 0, y: dtLayer.bounds.size.height - borderWidth, width: dtLayer.bounds.size.width, height: borderWidth)
|
||||
}else if dtborderStyle == .left{
|
||||
borderLayer.frame = CGRect(x: 0, y: 0, width: borderWidth, height: dtLayer.bounds.size.height)
|
||||
}else if dtborderStyle == .right{
|
||||
borderLayer.frame = CGRect(x: dtLayer.bounds.size.width - borderWidth, y: 0, width: borderWidth, height: dtLayer.bounds.size.height)
|
||||
}else{
|
||||
borderLayer.frame = CGRect(x: 0, y: 0, width: dtLayer.bounds.size.width, height: borderWidth)
|
||||
}
|
||||
dtLayer.addSublayer(borderLayer)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,11 +94,23 @@ public class DTTextField: UITextField {
|
||||
public var hideErrorWhenEditing:Bool = true
|
||||
|
||||
public var errorFont = UIFont.systemFont(ofSize: 10.0){
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
didSet{
|
||||
lblError.font = errorFont
|
||||
invalidateIntrinsicContentSize()
|
||||
}
|
||||
}
|
||||
|
||||
public var errorTextColor = UIColor.red {
|
||||
didSet{
|
||||
lblError.textColor = errorTextColor
|
||||
}
|
||||
}
|
||||
|
||||
public var floatPlaceholderFont = UIFont.systemFont(ofSize: 10.0){
|
||||
didSet{ invalidateIntrinsicContentSize() }
|
||||
didSet{
|
||||
lblFloatPlaceholder.font = floatPlaceholderFont
|
||||
invalidateIntrinsicContentSize()
|
||||
}
|
||||
}
|
||||
|
||||
public var paddingYFloatLabel:CGFloat = 3.0{
|
||||
@@ -85,18 +122,32 @@ public class DTTextField: UITextField {
|
||||
}
|
||||
|
||||
public var borderColor:UIColor = UIColor(red: 204.0/255.0, green: 204.0/255.0, blue: 204.0/255.0, alpha: 1.0){
|
||||
didSet{ dtLayer.borderColor = borderColor.cgColor }
|
||||
didSet{
|
||||
switch dtborderStyle {
|
||||
case .none,.rounded,.sqare:
|
||||
dtLayer.borderColor = borderColor.cgColor
|
||||
case .bottom,.right,.top,.left:
|
||||
borderLayer.backgroundColor = borderColor.cgColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var canShowBorder:Bool = true{
|
||||
didSet{ dtLayer.isHidden = !canShowBorder }
|
||||
didSet{
|
||||
switch dtborderStyle {
|
||||
case .none,.rounded,.sqare:
|
||||
dtLayer.isHidden = !canShowBorder
|
||||
case .bottom,.right,.top,.left:
|
||||
borderLayer.isHidden = !canShowBorder
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public var placeholderColor:UIColor?{
|
||||
didSet{
|
||||
guard let color = placeholderColor else { return }
|
||||
attributedPlaceholder = NSAttributedString(string: placeholderFinal,
|
||||
attributes: [NSAttributedStringKey.foregroundColor:color])
|
||||
attributes: [NSAttributedString.Key.foregroundColor:color])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,7 +205,7 @@ public class DTTextField: UITextField {
|
||||
}
|
||||
}
|
||||
|
||||
override public var borderStyle: UITextBorderStyle{
|
||||
override public var borderStyle: UITextField.BorderStyle{
|
||||
didSet{
|
||||
guard borderStyle != oldValue else { return }
|
||||
borderStyle = .none
|
||||
@@ -177,7 +228,7 @@ public class DTTextField: UITextField {
|
||||
return
|
||||
}
|
||||
attributedPlaceholder = NSAttributedString(string: placeholderFinal,
|
||||
attributes: [NSAttributedStringKey.foregroundColor:color])
|
||||
attributes: [NSAttributedString.Key.foregroundColor:color])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +272,7 @@ public class DTTextField: UITextField {
|
||||
|
||||
lblError.frame = CGRect.zero
|
||||
lblError.font = errorFont
|
||||
lblError.textColor = UIColor.red
|
||||
lblError.textColor = errorTextColor
|
||||
lblError.numberOfLines = 0
|
||||
lblError.isHidden = true
|
||||
|
||||
@@ -433,6 +484,8 @@ public class DTTextField: UITextField {
|
||||
y: bounds.origin.y,
|
||||
width: bounds.width,
|
||||
height: dtLayerHeight)
|
||||
let borderStype = dtborderStyle
|
||||
dtborderStyle = borderStype
|
||||
CATransaction.commit()
|
||||
|
||||
if showErrorLabel {
|
||||
Reference in New Issue
Block a user