├── README.md ├── _config.yml ├── kPlaceholderTextFiled.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── SOTSYS175.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── SOTSYS175.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── kPlaceholderTextFiled.xcscheme │ └── xcschememanagement.plist ├── kPlaceholderTextFiled ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.swift └── kTextFiledPlaceHolder.swift ├── kPlaceholderTextFiledTests ├── Info.plist └── kPlaceholderTextFiledTests.swift └── kPlaceholderTextFiledUITests ├── Info.plist └── kPlaceholderTextFiledUITests.swift /README.md: -------------------------------------------------------------------------------- 1 | The objective of this code is to guide you to create login screen with TextInputLayout in iOS app. 2 | 3 | Labels tell users what information belongs in the provided form field. Usually, Labels are placed outside the form field. 4 | 5 | However, Placeholder text situates inside a form field, which is an additional hint, that disappear when the user types in the field. There are some forms replace field labels with in-field placeholder text to minimize clutter on the page or the form’s length. The placeholder text with form labels is the best combination to improve completion and conversion rates. 6 | 7 | Having labels outside the form fields make important information visible at all time that makes easy for users to write the text. Hope this tutorial solves your problem, else, our iPhone App Development team would love to help you further. 8 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0F163DFC1D2FAAF700D33FD9 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F163DFB1D2FAAF700D33FD9 /* AppDelegate.swift */; }; 11 | 0F163DFE1D2FAAF800D33FD9 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F163DFD1D2FAAF800D33FD9 /* ViewController.swift */; }; 12 | 0F163E011D2FAAF800D33FD9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F163DFF1D2FAAF800D33FD9 /* Main.storyboard */; }; 13 | 0F163E031D2FAAF800D33FD9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0F163E021D2FAAF800D33FD9 /* Assets.xcassets */; }; 14 | 0F163E061D2FAAF800D33FD9 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0F163E041D2FAAF800D33FD9 /* LaunchScreen.storyboard */; }; 15 | 0F163E111D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F163E101D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.swift */; }; 16 | 0F163E1C1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F163E1B1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.swift */; }; 17 | 0F163E2A1D2FAB2000D33FD9 /* kTextFiledPlaceHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F163E291D2FAB2000D33FD9 /* kTextFiledPlaceHolder.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | 0F163E0D1D2FAAF800D33FD9 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = 0F163DF01D2FAAF700D33FD9 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = 0F163DF71D2FAAF700D33FD9; 26 | remoteInfo = kPlaceholderTextFiled; 27 | }; 28 | 0F163E181D2FAAF800D33FD9 /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 0F163DF01D2FAAF700D33FD9 /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 0F163DF71D2FAAF700D33FD9; 33 | remoteInfo = kPlaceholderTextFiled; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 0F163DF81D2FAAF700D33FD9 /* kPlaceholderTextFiled.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = kPlaceholderTextFiled.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39 | 0F163DFB1D2FAAF700D33FD9 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 40 | 0F163DFD1D2FAAF800D33FD9 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 41 | 0F163E001D2FAAF800D33FD9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 42 | 0F163E021D2FAAF800D33FD9 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 43 | 0F163E051D2FAAF800D33FD9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 44 | 0F163E071D2FAAF800D33FD9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | 0F163E0C1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = kPlaceholderTextFiledTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 46 | 0F163E101D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = kPlaceholderTextFiledTests.swift; sourceTree = ""; }; 47 | 0F163E121D2FAAF800D33FD9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 0F163E171D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = kPlaceholderTextFiledUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 0F163E1B1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = kPlaceholderTextFiledUITests.swift; sourceTree = ""; }; 50 | 0F163E1D1D2FAAF800D33FD9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 0F163E291D2FAB2000D33FD9 /* kTextFiledPlaceHolder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = kTextFiledPlaceHolder.swift; sourceTree = ""; }; 52 | /* End PBXFileReference section */ 53 | 54 | /* Begin PBXFrameworksBuildPhase section */ 55 | 0F163DF51D2FAAF700D33FD9 /* Frameworks */ = { 56 | isa = PBXFrameworksBuildPhase; 57 | buildActionMask = 2147483647; 58 | files = ( 59 | ); 60 | runOnlyForDeploymentPostprocessing = 0; 61 | }; 62 | 0F163E091D2FAAF800D33FD9 /* Frameworks */ = { 63 | isa = PBXFrameworksBuildPhase; 64 | buildActionMask = 2147483647; 65 | files = ( 66 | ); 67 | runOnlyForDeploymentPostprocessing = 0; 68 | }; 69 | 0F163E141D2FAAF800D33FD9 /* Frameworks */ = { 70 | isa = PBXFrameworksBuildPhase; 71 | buildActionMask = 2147483647; 72 | files = ( 73 | ); 74 | runOnlyForDeploymentPostprocessing = 0; 75 | }; 76 | /* End PBXFrameworksBuildPhase section */ 77 | 78 | /* Begin PBXGroup section */ 79 | 0F163DEF1D2FAAF700D33FD9 = { 80 | isa = PBXGroup; 81 | children = ( 82 | 0F163DFA1D2FAAF700D33FD9 /* kPlaceholderTextFiled */, 83 | 0F163E0F1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests */, 84 | 0F163E1A1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests */, 85 | 0F163DF91D2FAAF700D33FD9 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 0F163DF91D2FAAF700D33FD9 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 0F163DF81D2FAAF700D33FD9 /* kPlaceholderTextFiled.app */, 93 | 0F163E0C1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.xctest */, 94 | 0F163E171D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.xctest */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 0F163DFA1D2FAAF700D33FD9 /* kPlaceholderTextFiled */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 0F163DFB1D2FAAF700D33FD9 /* AppDelegate.swift */, 103 | 0F163DFD1D2FAAF800D33FD9 /* ViewController.swift */, 104 | 0F163E291D2FAB2000D33FD9 /* kTextFiledPlaceHolder.swift */, 105 | 0F163DFF1D2FAAF800D33FD9 /* Main.storyboard */, 106 | 0F163E021D2FAAF800D33FD9 /* Assets.xcassets */, 107 | 0F163E041D2FAAF800D33FD9 /* LaunchScreen.storyboard */, 108 | 0F163E071D2FAAF800D33FD9 /* Info.plist */, 109 | ); 110 | path = kPlaceholderTextFiled; 111 | sourceTree = ""; 112 | }; 113 | 0F163E0F1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 0F163E101D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.swift */, 117 | 0F163E121D2FAAF800D33FD9 /* Info.plist */, 118 | ); 119 | path = kPlaceholderTextFiledTests; 120 | sourceTree = ""; 121 | }; 122 | 0F163E1A1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 0F163E1B1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.swift */, 126 | 0F163E1D1D2FAAF800D33FD9 /* Info.plist */, 127 | ); 128 | path = kPlaceholderTextFiledUITests; 129 | sourceTree = ""; 130 | }; 131 | /* End PBXGroup section */ 132 | 133 | /* Begin PBXNativeTarget section */ 134 | 0F163DF71D2FAAF700D33FD9 /* kPlaceholderTextFiled */ = { 135 | isa = PBXNativeTarget; 136 | buildConfigurationList = 0F163E201D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiled" */; 137 | buildPhases = ( 138 | 0F163DF41D2FAAF700D33FD9 /* Sources */, 139 | 0F163DF51D2FAAF700D33FD9 /* Frameworks */, 140 | 0F163DF61D2FAAF700D33FD9 /* Resources */, 141 | ); 142 | buildRules = ( 143 | ); 144 | dependencies = ( 145 | ); 146 | name = kPlaceholderTextFiled; 147 | productName = kPlaceholderTextFiled; 148 | productReference = 0F163DF81D2FAAF700D33FD9 /* kPlaceholderTextFiled.app */; 149 | productType = "com.apple.product-type.application"; 150 | }; 151 | 0F163E0B1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests */ = { 152 | isa = PBXNativeTarget; 153 | buildConfigurationList = 0F163E231D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiledTests" */; 154 | buildPhases = ( 155 | 0F163E081D2FAAF800D33FD9 /* Sources */, 156 | 0F163E091D2FAAF800D33FD9 /* Frameworks */, 157 | 0F163E0A1D2FAAF800D33FD9 /* Resources */, 158 | ); 159 | buildRules = ( 160 | ); 161 | dependencies = ( 162 | 0F163E0E1D2FAAF800D33FD9 /* PBXTargetDependency */, 163 | ); 164 | name = kPlaceholderTextFiledTests; 165 | productName = kPlaceholderTextFiledTests; 166 | productReference = 0F163E0C1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.xctest */; 167 | productType = "com.apple.product-type.bundle.unit-test"; 168 | }; 169 | 0F163E161D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 0F163E261D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiledUITests" */; 172 | buildPhases = ( 173 | 0F163E131D2FAAF800D33FD9 /* Sources */, 174 | 0F163E141D2FAAF800D33FD9 /* Frameworks */, 175 | 0F163E151D2FAAF800D33FD9 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | 0F163E191D2FAAF800D33FD9 /* PBXTargetDependency */, 181 | ); 182 | name = kPlaceholderTextFiledUITests; 183 | productName = kPlaceholderTextFiledUITests; 184 | productReference = 0F163E171D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.xctest */; 185 | productType = "com.apple.product-type.bundle.ui-testing"; 186 | }; 187 | /* End PBXNativeTarget section */ 188 | 189 | /* Begin PBXProject section */ 190 | 0F163DF01D2FAAF700D33FD9 /* Project object */ = { 191 | isa = PBXProject; 192 | attributes = { 193 | LastSwiftUpdateCheck = 0730; 194 | LastUpgradeCheck = 0730; 195 | ORGANIZATIONNAME = " SOTSYS175"; 196 | TargetAttributes = { 197 | 0F163DF71D2FAAF700D33FD9 = { 198 | CreatedOnToolsVersion = 7.3.1; 199 | }; 200 | 0F163E0B1D2FAAF800D33FD9 = { 201 | CreatedOnToolsVersion = 7.3.1; 202 | TestTargetID = 0F163DF71D2FAAF700D33FD9; 203 | }; 204 | 0F163E161D2FAAF800D33FD9 = { 205 | CreatedOnToolsVersion = 7.3.1; 206 | TestTargetID = 0F163DF71D2FAAF700D33FD9; 207 | }; 208 | }; 209 | }; 210 | buildConfigurationList = 0F163DF31D2FAAF700D33FD9 /* Build configuration list for PBXProject "kPlaceholderTextFiled" */; 211 | compatibilityVersion = "Xcode 3.2"; 212 | developmentRegion = English; 213 | hasScannedForEncodings = 0; 214 | knownRegions = ( 215 | en, 216 | Base, 217 | ); 218 | mainGroup = 0F163DEF1D2FAAF700D33FD9; 219 | productRefGroup = 0F163DF91D2FAAF700D33FD9 /* Products */; 220 | projectDirPath = ""; 221 | projectRoot = ""; 222 | targets = ( 223 | 0F163DF71D2FAAF700D33FD9 /* kPlaceholderTextFiled */, 224 | 0F163E0B1D2FAAF800D33FD9 /* kPlaceholderTextFiledTests */, 225 | 0F163E161D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests */, 226 | ); 227 | }; 228 | /* End PBXProject section */ 229 | 230 | /* Begin PBXResourcesBuildPhase section */ 231 | 0F163DF61D2FAAF700D33FD9 /* Resources */ = { 232 | isa = PBXResourcesBuildPhase; 233 | buildActionMask = 2147483647; 234 | files = ( 235 | 0F163E061D2FAAF800D33FD9 /* LaunchScreen.storyboard in Resources */, 236 | 0F163E031D2FAAF800D33FD9 /* Assets.xcassets in Resources */, 237 | 0F163E011D2FAAF800D33FD9 /* Main.storyboard in Resources */, 238 | ); 239 | runOnlyForDeploymentPostprocessing = 0; 240 | }; 241 | 0F163E0A1D2FAAF800D33FD9 /* Resources */ = { 242 | isa = PBXResourcesBuildPhase; 243 | buildActionMask = 2147483647; 244 | files = ( 245 | ); 246 | runOnlyForDeploymentPostprocessing = 0; 247 | }; 248 | 0F163E151D2FAAF800D33FD9 /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | ); 253 | runOnlyForDeploymentPostprocessing = 0; 254 | }; 255 | /* End PBXResourcesBuildPhase section */ 256 | 257 | /* Begin PBXSourcesBuildPhase section */ 258 | 0F163DF41D2FAAF700D33FD9 /* Sources */ = { 259 | isa = PBXSourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | 0F163DFE1D2FAAF800D33FD9 /* ViewController.swift in Sources */, 263 | 0F163DFC1D2FAAF700D33FD9 /* AppDelegate.swift in Sources */, 264 | 0F163E2A1D2FAB2000D33FD9 /* kTextFiledPlaceHolder.swift in Sources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | 0F163E081D2FAAF800D33FD9 /* Sources */ = { 269 | isa = PBXSourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | 0F163E111D2FAAF800D33FD9 /* kPlaceholderTextFiledTests.swift in Sources */, 273 | ); 274 | runOnlyForDeploymentPostprocessing = 0; 275 | }; 276 | 0F163E131D2FAAF800D33FD9 /* Sources */ = { 277 | isa = PBXSourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | 0F163E1C1D2FAAF800D33FD9 /* kPlaceholderTextFiledUITests.swift in Sources */, 281 | ); 282 | runOnlyForDeploymentPostprocessing = 0; 283 | }; 284 | /* End PBXSourcesBuildPhase section */ 285 | 286 | /* Begin PBXTargetDependency section */ 287 | 0F163E0E1D2FAAF800D33FD9 /* PBXTargetDependency */ = { 288 | isa = PBXTargetDependency; 289 | target = 0F163DF71D2FAAF700D33FD9 /* kPlaceholderTextFiled */; 290 | targetProxy = 0F163E0D1D2FAAF800D33FD9 /* PBXContainerItemProxy */; 291 | }; 292 | 0F163E191D2FAAF800D33FD9 /* PBXTargetDependency */ = { 293 | isa = PBXTargetDependency; 294 | target = 0F163DF71D2FAAF700D33FD9 /* kPlaceholderTextFiled */; 295 | targetProxy = 0F163E181D2FAAF800D33FD9 /* PBXContainerItemProxy */; 296 | }; 297 | /* End PBXTargetDependency section */ 298 | 299 | /* Begin PBXVariantGroup section */ 300 | 0F163DFF1D2FAAF800D33FD9 /* Main.storyboard */ = { 301 | isa = PBXVariantGroup; 302 | children = ( 303 | 0F163E001D2FAAF800D33FD9 /* Base */, 304 | ); 305 | name = Main.storyboard; 306 | sourceTree = ""; 307 | }; 308 | 0F163E041D2FAAF800D33FD9 /* LaunchScreen.storyboard */ = { 309 | isa = PBXVariantGroup; 310 | children = ( 311 | 0F163E051D2FAAF800D33FD9 /* Base */, 312 | ); 313 | name = LaunchScreen.storyboard; 314 | sourceTree = ""; 315 | }; 316 | /* End PBXVariantGroup section */ 317 | 318 | /* Begin XCBuildConfiguration section */ 319 | 0F163E1E1D2FAAF800D33FD9 /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ALWAYS_SEARCH_USER_PATHS = NO; 323 | CLANG_ANALYZER_NONNULL = YES; 324 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 325 | CLANG_CXX_LIBRARY = "libc++"; 326 | CLANG_ENABLE_MODULES = YES; 327 | CLANG_ENABLE_OBJC_ARC = YES; 328 | CLANG_WARN_BOOL_CONVERSION = YES; 329 | CLANG_WARN_CONSTANT_CONVERSION = YES; 330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INT_CONVERSION = YES; 334 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 335 | CLANG_WARN_UNREACHABLE_CODE = YES; 336 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 337 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 338 | COPY_PHASE_STRIP = NO; 339 | DEBUG_INFORMATION_FORMAT = dwarf; 340 | ENABLE_STRICT_OBJC_MSGSEND = YES; 341 | ENABLE_TESTABILITY = YES; 342 | GCC_C_LANGUAGE_STANDARD = gnu99; 343 | GCC_DYNAMIC_NO_PIC = NO; 344 | GCC_NO_COMMON_BLOCKS = YES; 345 | GCC_OPTIMIZATION_LEVEL = 0; 346 | GCC_PREPROCESSOR_DEFINITIONS = ( 347 | "DEBUG=1", 348 | "$(inherited)", 349 | ); 350 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 351 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 352 | GCC_WARN_UNDECLARED_SELECTOR = YES; 353 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 354 | GCC_WARN_UNUSED_FUNCTION = YES; 355 | GCC_WARN_UNUSED_VARIABLE = YES; 356 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 357 | MTL_ENABLE_DEBUG_INFO = YES; 358 | ONLY_ACTIVE_ARCH = YES; 359 | SDKROOT = iphoneos; 360 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 361 | }; 362 | name = Debug; 363 | }; 364 | 0F163E1F1D2FAAF800D33FD9 /* Release */ = { 365 | isa = XCBuildConfiguration; 366 | buildSettings = { 367 | ALWAYS_SEARCH_USER_PATHS = NO; 368 | CLANG_ANALYZER_NONNULL = YES; 369 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 370 | CLANG_CXX_LIBRARY = "libc++"; 371 | CLANG_ENABLE_MODULES = YES; 372 | CLANG_ENABLE_OBJC_ARC = YES; 373 | CLANG_WARN_BOOL_CONVERSION = YES; 374 | CLANG_WARN_CONSTANT_CONVERSION = YES; 375 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 376 | CLANG_WARN_EMPTY_BODY = YES; 377 | CLANG_WARN_ENUM_CONVERSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 380 | CLANG_WARN_UNREACHABLE_CODE = YES; 381 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 382 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 383 | COPY_PHASE_STRIP = NO; 384 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 385 | ENABLE_NS_ASSERTIONS = NO; 386 | ENABLE_STRICT_OBJC_MSGSEND = YES; 387 | GCC_C_LANGUAGE_STANDARD = gnu99; 388 | GCC_NO_COMMON_BLOCKS = YES; 389 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 390 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 391 | GCC_WARN_UNDECLARED_SELECTOR = YES; 392 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 393 | GCC_WARN_UNUSED_FUNCTION = YES; 394 | GCC_WARN_UNUSED_VARIABLE = YES; 395 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 396 | MTL_ENABLE_DEBUG_INFO = NO; 397 | SDKROOT = iphoneos; 398 | VALIDATE_PRODUCT = YES; 399 | }; 400 | name = Release; 401 | }; 402 | 0F163E211D2FAAF800D33FD9 /* Debug */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 406 | INFOPLIST_FILE = kPlaceholderTextFiled/Info.plist; 407 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 408 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiled"; 409 | PRODUCT_NAME = "$(TARGET_NAME)"; 410 | }; 411 | name = Debug; 412 | }; 413 | 0F163E221D2FAAF800D33FD9 /* Release */ = { 414 | isa = XCBuildConfiguration; 415 | buildSettings = { 416 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 417 | INFOPLIST_FILE = kPlaceholderTextFiled/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 419 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiled"; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | }; 422 | name = Release; 423 | }; 424 | 0F163E241D2FAAF800D33FD9 /* Debug */ = { 425 | isa = XCBuildConfiguration; 426 | buildSettings = { 427 | BUNDLE_LOADER = "$(TEST_HOST)"; 428 | INFOPLIST_FILE = kPlaceholderTextFiledTests/Info.plist; 429 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 430 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiledTests"; 431 | PRODUCT_NAME = "$(TARGET_NAME)"; 432 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/kPlaceholderTextFiled.app/kPlaceholderTextFiled"; 433 | }; 434 | name = Debug; 435 | }; 436 | 0F163E251D2FAAF800D33FD9 /* Release */ = { 437 | isa = XCBuildConfiguration; 438 | buildSettings = { 439 | BUNDLE_LOADER = "$(TEST_HOST)"; 440 | INFOPLIST_FILE = kPlaceholderTextFiledTests/Info.plist; 441 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 442 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiledTests"; 443 | PRODUCT_NAME = "$(TARGET_NAME)"; 444 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/kPlaceholderTextFiled.app/kPlaceholderTextFiled"; 445 | }; 446 | name = Release; 447 | }; 448 | 0F163E271D2FAAF800D33FD9 /* Debug */ = { 449 | isa = XCBuildConfiguration; 450 | buildSettings = { 451 | INFOPLIST_FILE = kPlaceholderTextFiledUITests/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 453 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiledUITests"; 454 | PRODUCT_NAME = "$(TARGET_NAME)"; 455 | TEST_TARGET_NAME = kPlaceholderTextFiled; 456 | }; 457 | name = Debug; 458 | }; 459 | 0F163E281D2FAAF800D33FD9 /* Release */ = { 460 | isa = XCBuildConfiguration; 461 | buildSettings = { 462 | INFOPLIST_FILE = kPlaceholderTextFiledUITests/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 464 | PRODUCT_BUNDLE_IDENTIFIER = "com.-.kPlaceholderTextFiledUITests"; 465 | PRODUCT_NAME = "$(TARGET_NAME)"; 466 | TEST_TARGET_NAME = kPlaceholderTextFiled; 467 | }; 468 | name = Release; 469 | }; 470 | /* End XCBuildConfiguration section */ 471 | 472 | /* Begin XCConfigurationList section */ 473 | 0F163DF31D2FAAF700D33FD9 /* Build configuration list for PBXProject "kPlaceholderTextFiled" */ = { 474 | isa = XCConfigurationList; 475 | buildConfigurations = ( 476 | 0F163E1E1D2FAAF800D33FD9 /* Debug */, 477 | 0F163E1F1D2FAAF800D33FD9 /* Release */, 478 | ); 479 | defaultConfigurationIsVisible = 0; 480 | defaultConfigurationName = Release; 481 | }; 482 | 0F163E201D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiled" */ = { 483 | isa = XCConfigurationList; 484 | buildConfigurations = ( 485 | 0F163E211D2FAAF800D33FD9 /* Debug */, 486 | 0F163E221D2FAAF800D33FD9 /* Release */, 487 | ); 488 | defaultConfigurationIsVisible = 0; 489 | }; 490 | 0F163E231D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiledTests" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | 0F163E241D2FAAF800D33FD9 /* Debug */, 494 | 0F163E251D2FAAF800D33FD9 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | }; 498 | 0F163E261D2FAAF800D33FD9 /* Build configuration list for PBXNativeTarget "kPlaceholderTextFiledUITests" */ = { 499 | isa = XCConfigurationList; 500 | buildConfigurations = ( 501 | 0F163E271D2FAAF800D33FD9 /* Debug */, 502 | 0F163E281D2FAAF800D33FD9 /* Release */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | }; 506 | /* End XCConfigurationList section */ 507 | }; 508 | rootObject = 0F163DF01D2FAAF700D33FD9 /* Project object */; 509 | } 510 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/project.xcworkspace/xcuserdata/SOTSYS175.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/KiranPatelSpaceo/TextInputLayout/ecba2a6e868a2b5ccabe6f7e69e94aa3dd769fae/kPlaceholderTextFiled.xcodeproj/project.xcworkspace/xcuserdata/SOTSYS175.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/xcuserdata/SOTSYS175.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/xcuserdata/SOTSYS175.xcuserdatad/xcschemes/kPlaceholderTextFiled.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 89 | 90 | 94 | 95 | 96 | 97 | 103 | 105 | 111 | 112 | 113 | 114 | 116 | 117 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled.xcodeproj/xcuserdata/SOTSYS175.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | kPlaceholderTextFiled.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 0F163DF71D2FAAF700D33FD9 16 | 17 | primary 18 | 19 | 20 | 0F163E0B1D2FAAF800D33FD9 21 | 22 | primary 23 | 24 | 25 | 0F163E161D2FAAF800D33FD9 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // kPlaceholderTextFiled 4 | // 5 | // Created by Kiran Patel on 7/8/16. 6 | // Copyright © 2016 SOTSYS175. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /kPlaceholderTextFiled/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // kPlaceholderTextFiled 4 | // 5 | // Created by Kiran Patel on 7/8/16. 6 | // Copyright © 2016 SOTSYS175. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet var textName: kTextFiledPlaceHolder! 14 | @IBOutlet var textEmail: kTextFiledPlaceHolder! 15 | @IBOutlet var textPassword: kTextFiledPlaceHolder! 16 | override func viewDidLoad() { 17 | super.viewDidLoad() 18 | textName.directionMaterial = placeholderDirection.placeholderDown 19 | textEmail.directionMaterial = placeholderDirection.placeholderDown 20 | textPassword.directionMaterial = placeholderDirection.placeholderDown 21 | /* ----------------Programatically ----------------------*/ 22 | /* let textfieldName : kTextFiledPlaceHolder = kTextFiledPlaceHolder.init(frame: CGRectMake(10, 50, self.view.frame.size.width-20, 30)) 23 | textfieldName.placeholder = "Name" 24 | textfieldName.placeHolderColor = UIColor.darkGrayColor() 25 | textfieldName.difference = 35 26 | textfieldName.directionMaterial = placeholderDirection.placeholderUp 27 | self.view.addSubview(textfieldName) 28 | */ 29 | 30 | } 31 | 32 | func textFieldDidEndEditing(textField: UITextField){ 33 | print(textField.text) 34 | 35 | } 36 | override func didReceiveMemoryWarning() { 37 | super.didReceiveMemoryWarning() 38 | // Dispose of any resources that can be recreated. 39 | } 40 | 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /kPlaceholderTextFiled/kTextFiledPlaceHolder.swift: -------------------------------------------------------------------------------- 1 | // 2 | // kTextFiledPlaceHolder.swift 3 | // kPlaceholderTextFiled 4 | // 5 | // Created by Kiran Patel on 7/8/16. 6 | // Copyright © 2016 SOTSYS175. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum placeholderDirection: String { 12 | case placeholderUp = "up" 13 | case placeholderDown = "down" 14 | 15 | } 16 | class kTextFiledPlaceHolder: UITextField { 17 | var enableMaterialPlaceHolder : Bool = true 18 | var placeholderAttributes = NSDictionary() 19 | var lblPlaceHolder = UILabel() 20 | var defaultFont = UIFont() 21 | var difference: CGFloat = 35.0 22 | var directionMaterial = placeholderDirection.placeholderUp 23 | var isUnderLineAvailabe : Bool = true 24 | override init(frame: CGRect) { 25 | super.init(frame: frame) 26 | Initialize () 27 | } 28 | required init?(coder aDecoder: NSCoder) { 29 | super.init(coder: aDecoder) 30 | Initialize () 31 | } 32 | func Initialize(){ 33 | self.clipsToBounds = false 34 | self.addTarget(self, action: #selector(kTextFiledPlaceHolder.textFieldDidChange), for: .editingChanged) 35 | self.EnableMaterialPlaceHolder(enableMaterialPlaceHolder: true) 36 | if isUnderLineAvailabe { 37 | let underLine = UIImageView() 38 | underLine.backgroundColor = UIColor.init(red: 197/255.0, green: 197/255.0, blue: 197/255.0, alpha: 0.8) 39 | // underLine.frame = CGRectMake(0, self.frame.size.height-1, self.frame.size.width, 1) 40 | underLine.frame = CGRect(x: 0, y: self.frame.size.height-1, width : self.frame.size.width, height : 1) 41 | 42 | underLine.clipsToBounds = true 43 | self.addSubview(underLine) 44 | } 45 | defaultFont = self.font! 46 | 47 | } 48 | @IBInspectable var placeHolderColor: UIColor? = UIColor.lightGray { 49 | didSet { 50 | self.attributedPlaceholder = NSAttributedString(string: self.placeholder! as String , 51 | attributes:[NSForegroundColorAttributeName: placeHolderColor!]) 52 | } 53 | } 54 | override internal var placeholder:String? { 55 | didSet { 56 | // NSLog("placeholder = \(placeholder)") 57 | } 58 | willSet { 59 | let atts = [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.labelFontSize] as [String : Any] 60 | self.attributedPlaceholder = NSAttributedString(string: newValue!, attributes:atts) 61 | self.EnableMaterialPlaceHolder(enableMaterialPlaceHolder: self.enableMaterialPlaceHolder) 62 | } 63 | 64 | } 65 | override internal var attributedText:NSAttributedString? { 66 | didSet { 67 | // NSLog("text = \(text)") 68 | } 69 | willSet { 70 | if (self.placeholder != nil) && (self.text != "") 71 | { 72 | let string = NSString(string : self.placeholder!) 73 | self.placeholderText(string) 74 | } 75 | 76 | } 77 | } 78 | func textFieldDidChange(){ 79 | if self.enableMaterialPlaceHolder { 80 | if (self.text == nil) || (self.text?.characters.count)! > 0 { 81 | self.lblPlaceHolder.alpha = 1 82 | self.attributedPlaceholder = nil 83 | self.lblPlaceHolder.textColor = self.placeHolderColor 84 | let fontSize = self.font!.pointSize; 85 | self.lblPlaceHolder.font = UIFont.init(name: (self.font?.fontName)!, size: fontSize-3) 86 | } 87 | UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 1, options: .curveEaseInOut, animations: {() -> Void in 88 | if (self.text == nil) || (self.text?.characters.count)! <= 0 { 89 | self.lblPlaceHolder.font = self.defaultFont 90 | self.lblPlaceHolder.frame = CGRect(x: self.lblPlaceHolder.frame.origin.x, y : 0, width :self.frame.size.width, height : self.frame.size.height) 91 | } 92 | else { 93 | if self.directionMaterial == placeholderDirection.placeholderUp { 94 | self.lblPlaceHolder.frame = CGRect(x : self.lblPlaceHolder.frame.origin.x, y : -self.difference, width : self.frame.size.width, height : self.frame.size.height) 95 | }else{ 96 | self.lblPlaceHolder.frame = CGRect(x : self.lblPlaceHolder.frame.origin.x, y : self.difference, width : self.frame.size.width, height : self.frame.size.height) 97 | } 98 | 99 | } 100 | }, completion: {(finished: Bool) -> Void in 101 | }) 102 | } 103 | } 104 | func EnableMaterialPlaceHolder(enableMaterialPlaceHolder: Bool){ 105 | self.enableMaterialPlaceHolder = enableMaterialPlaceHolder 106 | self.lblPlaceHolder = UILabel() 107 | self.lblPlaceHolder.frame = CGRect(x: 0, y : 0, width : 0, height :self.frame.size.height) 108 | self.lblPlaceHolder.font = UIFont.systemFont(ofSize: 10) 109 | self.lblPlaceHolder.alpha = 0 110 | self.lblPlaceHolder.clipsToBounds = true 111 | self.addSubview(self.lblPlaceHolder) 112 | self.lblPlaceHolder.attributedText = self.attributedPlaceholder 113 | //self.lblPlaceHolder.sizeToFit() 114 | } 115 | func placeholderText(_ placeholder: NSString){ 116 | let atts = [NSForegroundColorAttributeName: UIColor.lightGray, NSFontAttributeName: UIFont.labelFontSize] as [String : Any] 117 | self.attributedPlaceholder = NSAttributedString(string: placeholder as String , attributes:atts) 118 | self.EnableMaterialPlaceHolder(enableMaterialPlaceHolder: self.enableMaterialPlaceHolder) 119 | } 120 | override func becomeFirstResponder()->(Bool){ 121 | let returnValue = super.becomeFirstResponder() 122 | return returnValue 123 | } 124 | override func resignFirstResponder()->(Bool){ 125 | let returnValue = super.resignFirstResponder() 126 | return returnValue 127 | } 128 | 129 | override func layoutSubviews() { 130 | super.layoutSubviews() 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /kPlaceholderTextFiledTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /kPlaceholderTextFiledTests/kPlaceholderTextFiledTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // kPlaceholderTextFiledTests.swift 3 | // kPlaceholderTextFiledTests 4 | // 5 | // Created by Kiran Patel on 7/8/16. 6 | // Copyright © 2016 SOTSYS175. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import kPlaceholderTextFiled 11 | 12 | class kPlaceholderTextFiledTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | // Use XCTAssert and related functions to verify your tests produce the correct results. 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /kPlaceholderTextFiledUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /kPlaceholderTextFiledUITests/kPlaceholderTextFiledUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // kPlaceholderTextFiledUITests.swift 3 | // kPlaceholderTextFiledUITests 4 | // 5 | // Created by Kiran Patel on 7/8/16. 6 | // Copyright © 2016 SOTSYS175. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class kPlaceholderTextFiledUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | super.setUp() 15 | 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | 18 | // In UI tests it is usually best to stop immediately when a failure occurs. 19 | continueAfterFailure = false 20 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. 21 | XCUIApplication().launch() 22 | 23 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 24 | } 25 | 26 | override func tearDown() { 27 | // Put teardown code here. This method is called after the invocation of each test method in the class. 28 | super.tearDown() 29 | } 30 | 31 | func testExample() { 32 | // Use recording to get started writing UI tests. 33 | // Use XCTAssert and related functions to verify your tests produce the correct results. 34 | } 35 | 36 | } 37 | --------------------------------------------------------------------------------