├── FloatingLabelInput.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── sprinthub.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist └── FloatingLabelInput ├── AppDelegate.swift ├── Assets.xcassets ├── AppIcon.appiconset │ └── Contents.json └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── FloatingLabelInput.swift ├── Info.plist └── ViewController.swift /FloatingLabelInput.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 2524AD09234CD76D002ADE9B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2524AD08234CD76D002ADE9B /* AppDelegate.swift */; }; 11 | 2524AD0B234CD76D002ADE9B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2524AD0A234CD76D002ADE9B /* ViewController.swift */; }; 12 | 2524AD0E234CD76D002ADE9B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2524AD0C234CD76D002ADE9B /* Main.storyboard */; }; 13 | 2524AD10234CD770002ADE9B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2524AD0F234CD770002ADE9B /* Assets.xcassets */; }; 14 | 2524AD13234CD770002ADE9B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2524AD11234CD770002ADE9B /* LaunchScreen.storyboard */; }; 15 | 2524AD1B234DDC5F002ADE9B /* FloatingLabelInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2524AD1A234DDC5F002ADE9B /* FloatingLabelInput.swift */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 2524AD05234CD76D002ADE9B /* FloatingLabelInput.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FloatingLabelInput.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 2524AD08234CD76D002ADE9B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 2524AD0A234CD76D002ADE9B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 2524AD0D234CD76D002ADE9B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 2524AD0F234CD770002ADE9B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 2524AD12234CD770002ADE9B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 2524AD14234CD770002ADE9B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 2524AD1A234DDC5F002ADE9B /* FloatingLabelInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingLabelInput.swift; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 2524AD02234CD76D002ADE9B /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | 2524ACFC234CD76D002ADE9B = { 41 | isa = PBXGroup; 42 | children = ( 43 | 2524AD07234CD76D002ADE9B /* FloatingLabelInput */, 44 | 2524AD06234CD76D002ADE9B /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | 2524AD06234CD76D002ADE9B /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 2524AD05234CD76D002ADE9B /* FloatingLabelInput.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | 2524AD07234CD76D002ADE9B /* FloatingLabelInput */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 2524AD08234CD76D002ADE9B /* AppDelegate.swift */, 60 | 2524AD0A234CD76D002ADE9B /* ViewController.swift */, 61 | 2524AD0C234CD76D002ADE9B /* Main.storyboard */, 62 | 2524AD0F234CD770002ADE9B /* Assets.xcassets */, 63 | 2524AD11234CD770002ADE9B /* LaunchScreen.storyboard */, 64 | 2524AD14234CD770002ADE9B /* Info.plist */, 65 | 2524AD1A234DDC5F002ADE9B /* FloatingLabelInput.swift */, 66 | ); 67 | path = FloatingLabelInput; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXNativeTarget section */ 73 | 2524AD04234CD76D002ADE9B /* FloatingLabelInput */ = { 74 | isa = PBXNativeTarget; 75 | buildConfigurationList = 2524AD17234CD770002ADE9B /* Build configuration list for PBXNativeTarget "FloatingLabelInput" */; 76 | buildPhases = ( 77 | 2524AD01234CD76D002ADE9B /* Sources */, 78 | 2524AD02234CD76D002ADE9B /* Frameworks */, 79 | 2524AD03234CD76D002ADE9B /* Resources */, 80 | ); 81 | buildRules = ( 82 | ); 83 | dependencies = ( 84 | ); 85 | name = FloatingLabelInput; 86 | productName = FloatingLabelInput; 87 | productReference = 2524AD05234CD76D002ADE9B /* FloatingLabelInput.app */; 88 | productType = "com.apple.product-type.application"; 89 | }; 90 | /* End PBXNativeTarget section */ 91 | 92 | /* Begin PBXProject section */ 93 | 2524ACFD234CD76D002ADE9B /* Project object */ = { 94 | isa = PBXProject; 95 | attributes = { 96 | LastSwiftUpdateCheck = 1020; 97 | LastUpgradeCheck = 1020; 98 | ORGANIZATIONNAME = "Sprinthub Mobile"; 99 | TargetAttributes = { 100 | 2524AD04234CD76D002ADE9B = { 101 | CreatedOnToolsVersion = 10.2.1; 102 | }; 103 | }; 104 | }; 105 | buildConfigurationList = 2524AD00234CD76D002ADE9B /* Build configuration list for PBXProject "FloatingLabelInput" */; 106 | compatibilityVersion = "Xcode 9.3"; 107 | developmentRegion = en; 108 | hasScannedForEncodings = 0; 109 | knownRegions = ( 110 | en, 111 | Base, 112 | ); 113 | mainGroup = 2524ACFC234CD76D002ADE9B; 114 | productRefGroup = 2524AD06234CD76D002ADE9B /* Products */; 115 | projectDirPath = ""; 116 | projectRoot = ""; 117 | targets = ( 118 | 2524AD04234CD76D002ADE9B /* FloatingLabelInput */, 119 | ); 120 | }; 121 | /* End PBXProject section */ 122 | 123 | /* Begin PBXResourcesBuildPhase section */ 124 | 2524AD03234CD76D002ADE9B /* Resources */ = { 125 | isa = PBXResourcesBuildPhase; 126 | buildActionMask = 2147483647; 127 | files = ( 128 | 2524AD13234CD770002ADE9B /* LaunchScreen.storyboard in Resources */, 129 | 2524AD10234CD770002ADE9B /* Assets.xcassets in Resources */, 130 | 2524AD0E234CD76D002ADE9B /* Main.storyboard in Resources */, 131 | ); 132 | runOnlyForDeploymentPostprocessing = 0; 133 | }; 134 | /* End PBXResourcesBuildPhase section */ 135 | 136 | /* Begin PBXSourcesBuildPhase section */ 137 | 2524AD01234CD76D002ADE9B /* Sources */ = { 138 | isa = PBXSourcesBuildPhase; 139 | buildActionMask = 2147483647; 140 | files = ( 141 | 2524AD0B234CD76D002ADE9B /* ViewController.swift in Sources */, 142 | 2524AD09234CD76D002ADE9B /* AppDelegate.swift in Sources */, 143 | 2524AD1B234DDC5F002ADE9B /* FloatingLabelInput.swift in Sources */, 144 | ); 145 | runOnlyForDeploymentPostprocessing = 0; 146 | }; 147 | /* End PBXSourcesBuildPhase section */ 148 | 149 | /* Begin PBXVariantGroup section */ 150 | 2524AD0C234CD76D002ADE9B /* Main.storyboard */ = { 151 | isa = PBXVariantGroup; 152 | children = ( 153 | 2524AD0D234CD76D002ADE9B /* Base */, 154 | ); 155 | name = Main.storyboard; 156 | sourceTree = ""; 157 | }; 158 | 2524AD11234CD770002ADE9B /* LaunchScreen.storyboard */ = { 159 | isa = PBXVariantGroup; 160 | children = ( 161 | 2524AD12234CD770002ADE9B /* Base */, 162 | ); 163 | name = LaunchScreen.storyboard; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXVariantGroup section */ 167 | 168 | /* Begin XCBuildConfiguration section */ 169 | 2524AD15234CD770002ADE9B /* Debug */ = { 170 | isa = XCBuildConfiguration; 171 | buildSettings = { 172 | ALWAYS_SEARCH_USER_PATHS = NO; 173 | CLANG_ANALYZER_NONNULL = YES; 174 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 175 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 176 | CLANG_CXX_LIBRARY = "libc++"; 177 | CLANG_ENABLE_MODULES = YES; 178 | CLANG_ENABLE_OBJC_ARC = YES; 179 | CLANG_ENABLE_OBJC_WEAK = YES; 180 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_COMMA = YES; 183 | CLANG_WARN_CONSTANT_CONVERSION = YES; 184 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 185 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 186 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 187 | CLANG_WARN_EMPTY_BODY = YES; 188 | CLANG_WARN_ENUM_CONVERSION = YES; 189 | CLANG_WARN_INFINITE_RECURSION = YES; 190 | CLANG_WARN_INT_CONVERSION = YES; 191 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 192 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 193 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 194 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 195 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 196 | CLANG_WARN_STRICT_PROTOTYPES = YES; 197 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 198 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 199 | CLANG_WARN_UNREACHABLE_CODE = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | CODE_SIGN_IDENTITY = "iPhone Developer"; 202 | COPY_PHASE_STRIP = NO; 203 | DEBUG_INFORMATION_FORMAT = dwarf; 204 | ENABLE_STRICT_OBJC_MSGSEND = YES; 205 | ENABLE_TESTABILITY = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu11; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 221 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 222 | MTL_FAST_MATH = YES; 223 | ONLY_ACTIVE_ARCH = YES; 224 | SDKROOT = iphoneos; 225 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 226 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 227 | }; 228 | name = Debug; 229 | }; 230 | 2524AD16234CD770002ADE9B /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_ANALYZER_NONNULL = YES; 235 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 237 | CLANG_CXX_LIBRARY = "libc++"; 238 | CLANG_ENABLE_MODULES = YES; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_ENABLE_OBJC_WEAK = YES; 241 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 242 | CLANG_WARN_BOOL_CONVERSION = YES; 243 | CLANG_WARN_COMMA = YES; 244 | CLANG_WARN_CONSTANT_CONVERSION = YES; 245 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 246 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 247 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 248 | CLANG_WARN_EMPTY_BODY = YES; 249 | CLANG_WARN_ENUM_CONVERSION = YES; 250 | CLANG_WARN_INFINITE_RECURSION = YES; 251 | CLANG_WARN_INT_CONVERSION = YES; 252 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 253 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 254 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 255 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 256 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 257 | CLANG_WARN_STRICT_PROTOTYPES = YES; 258 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 259 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 260 | CLANG_WARN_UNREACHABLE_CODE = YES; 261 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 262 | CODE_SIGN_IDENTITY = "iPhone Developer"; 263 | COPY_PHASE_STRIP = NO; 264 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 265 | ENABLE_NS_ASSERTIONS = NO; 266 | ENABLE_STRICT_OBJC_MSGSEND = YES; 267 | GCC_C_LANGUAGE_STANDARD = gnu11; 268 | GCC_NO_COMMON_BLOCKS = YES; 269 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 270 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 271 | GCC_WARN_UNDECLARED_SELECTOR = YES; 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 273 | GCC_WARN_UNUSED_FUNCTION = YES; 274 | GCC_WARN_UNUSED_VARIABLE = YES; 275 | IPHONEOS_DEPLOYMENT_TARGET = 12.2; 276 | MTL_ENABLE_DEBUG_INFO = NO; 277 | MTL_FAST_MATH = YES; 278 | SDKROOT = iphoneos; 279 | SWIFT_COMPILATION_MODE = wholemodule; 280 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 281 | VALIDATE_PRODUCT = YES; 282 | }; 283 | name = Release; 284 | }; 285 | 2524AD18234CD770002ADE9B /* Debug */ = { 286 | isa = XCBuildConfiguration; 287 | buildSettings = { 288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 289 | CODE_SIGN_STYLE = Automatic; 290 | INFOPLIST_FILE = FloatingLabelInput/Info.plist; 291 | LD_RUNPATH_SEARCH_PATHS = ( 292 | "$(inherited)", 293 | "@executable_path/Frameworks", 294 | ); 295 | PRODUCT_BUNDLE_IDENTIFIER = com.sprinthubmobile.FloatingLabelInput; 296 | PRODUCT_NAME = "$(TARGET_NAME)"; 297 | SWIFT_VERSION = 5.0; 298 | TARGETED_DEVICE_FAMILY = "1,2"; 299 | }; 300 | name = Debug; 301 | }; 302 | 2524AD19234CD770002ADE9B /* Release */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 306 | CODE_SIGN_STYLE = Automatic; 307 | INFOPLIST_FILE = FloatingLabelInput/Info.plist; 308 | LD_RUNPATH_SEARCH_PATHS = ( 309 | "$(inherited)", 310 | "@executable_path/Frameworks", 311 | ); 312 | PRODUCT_BUNDLE_IDENTIFIER = com.sprinthubmobile.FloatingLabelInput; 313 | PRODUCT_NAME = "$(TARGET_NAME)"; 314 | SWIFT_VERSION = 5.0; 315 | TARGETED_DEVICE_FAMILY = "1,2"; 316 | }; 317 | name = Release; 318 | }; 319 | /* End XCBuildConfiguration section */ 320 | 321 | /* Begin XCConfigurationList section */ 322 | 2524AD00234CD76D002ADE9B /* Build configuration list for PBXProject "FloatingLabelInput" */ = { 323 | isa = XCConfigurationList; 324 | buildConfigurations = ( 325 | 2524AD15234CD770002ADE9B /* Debug */, 326 | 2524AD16234CD770002ADE9B /* Release */, 327 | ); 328 | defaultConfigurationIsVisible = 0; 329 | defaultConfigurationName = Release; 330 | }; 331 | 2524AD17234CD770002ADE9B /* Build configuration list for PBXNativeTarget "FloatingLabelInput" */ = { 332 | isa = XCConfigurationList; 333 | buildConfigurations = ( 334 | 2524AD18234CD770002ADE9B /* Debug */, 335 | 2524AD19234CD770002ADE9B /* Release */, 336 | ); 337 | defaultConfigurationIsVisible = 0; 338 | defaultConfigurationName = Release; 339 | }; 340 | /* End XCConfigurationList section */ 341 | }; 342 | rootObject = 2524ACFD234CD76D002ADE9B /* Project object */; 343 | } 344 | -------------------------------------------------------------------------------- /FloatingLabelInput.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /FloatingLabelInput.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /FloatingLabelInput.xcodeproj/xcuserdata/sprinthub.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | FloatingLabelInput.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /FloatingLabelInput/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // FloatingLabelInput 4 | // 5 | // Created by Sprinthub on 08/10/2019. 6 | // Copyright © 2019 Sprinthub Mobile. 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: [UIApplication.LaunchOptionsKey: Any]?) -> 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 invalidate graphics rendering callbacks. 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 active 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 | -------------------------------------------------------------------------------- /FloatingLabelInput/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /FloatingLabelInput/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /FloatingLabelInput/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 | -------------------------------------------------------------------------------- /FloatingLabelInput/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 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /FloatingLabelInput/FloatingLabelInput.swift: -------------------------------------------------------------------------------- 1 | // 2 | // FloatingLabelInput.swift 3 | // FloatingLabelInput 4 | // 5 | // Created by Mark Boleigha on 09/10/2019. 6 | // Copyright © 2019 Sprinthub Mobile. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class FloatingLabelInput: UITextField { 12 | var floatingLabel: UILabel!// = UILabel(frame: CGRect.zero) 13 | var floatingLabelHeight: CGFloat = 14 14 | var button = UIButton(type: .custom) 15 | var imageView = UIImageView(frame: CGRect.zero) 16 | 17 | @IBInspectable 18 | var _placeholder: String? 19 | 20 | @IBInspectable 21 | var floatingLabelColor: UIColor = UIColor.black { 22 | didSet { 23 | self.floatingLabel.textColor = floatingLabelColor 24 | self.setNeedsDisplay() 25 | } 26 | } 27 | 28 | @IBInspectable 29 | var activeBorderColor: UIColor = UIColor.blue 30 | 31 | @IBInspectable 32 | var floatingLabelBackground: UIColor = UIColor.white.withAlphaComponent(1) { 33 | didSet { 34 | self.floatingLabel.backgroundColor = self.floatingLabelBackground 35 | self.setNeedsDisplay() 36 | } 37 | } 38 | 39 | @IBInspectable 40 | var floatingLabelFont: UIFont = UIFont.systemFont(ofSize: 14) { 41 | didSet { 42 | self.floatingLabel.font = self.floatingLabelFont 43 | self.font = self.floatingLabelFont 44 | self.setNeedsDisplay() 45 | } 46 | } 47 | 48 | @IBInspectable 49 | var _backgroundColor: UIColor = UIColor.white { 50 | didSet { 51 | self.layer.backgroundColor = self._backgroundColor.cgColor 52 | } 53 | } 54 | 55 | 56 | required init?(coder aDecoder: NSCoder) { 57 | super.init(coder: aDecoder) 58 | self._placeholder = (self._placeholder != nil) ? self._placeholder : placeholder 59 | placeholder = self._placeholder // Make sure the placeholder is shown 60 | self.floatingLabel = UILabel(frame: CGRect.zero) 61 | self.addTarget(self, action: #selector(self.addFloatingLabel), for: .editingDidBegin) 62 | self.addTarget(self, action: #selector(self.removeFloatingLabel), for: .editingDidEnd) 63 | } 64 | 65 | // Add a floating label to the view on becoming first responder 66 | @objc func addFloatingLabel() { 67 | if self.text == "" { 68 | self.floatingLabel.textColor = floatingLabelColor 69 | self.floatingLabel.font = floatingLabelFont 70 | self.floatingLabel.text = self._placeholder 71 | self.floatingLabel.layer.backgroundColor = UIColor.white.cgColor 72 | self.floatingLabel.translatesAutoresizingMaskIntoConstraints = false 73 | self.floatingLabel.clipsToBounds = true 74 | self.floatingLabel.frame = CGRect(x: 0, y: 0, width: floatingLabel.frame.width+4, height: floatingLabel.frame.height+2) 75 | self.floatingLabel.textAlignment = .center 76 | self.addSubview(self.floatingLabel) 77 | self.layer.borderColor = self.activeBorderColor.cgColor 78 | 79 | self.floatingLabel.bottomAnchor.constraint(equalTo: self.topAnchor, constant: -10).isActive = true // Place our label 10 pts above the text field 80 | self.placeholder = "" 81 | } 82 | // Floating label may be stuck behind text input. we bring it forward as it was the last item added to the view heirachy 83 | self.bringSubviewToFront(subviews.last!) 84 | self.setNeedsDisplay() 85 | } 86 | 87 | @objc func removeFloatingLabel() { 88 | if self.text == "" { 89 | UIView.animate(withDuration: 0.13) { 90 | self.subviews.forEach{ $0.removeFromSuperview() } 91 | self.setNeedsDisplay() 92 | } 93 | self.placeholder = self._placeholder 94 | } 95 | self.layer.borderColor = UIColor.black.cgColor 96 | } 97 | 98 | func addViewPasswordButton() { 99 | self.button.setImage(UIImage(named: "ic_reveal"), for: .normal) 100 | self.button.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0) 101 | self.button.frame = CGRect(x: 0, y: 16, width: 22, height: 16) 102 | self.button.clipsToBounds = true 103 | self.rightView = self.button 104 | self.rightViewMode = .always 105 | self.button.addTarget(self, action: #selector(self.enablePasswordVisibilityToggle), for: .touchUpInside) 106 | } 107 | 108 | func addImage(image: UIImage){ 109 | 110 | self.imageView.image = image 111 | self.imageView.frame = CGRect(x: 20, y: 0, width: 20, height: 20) 112 | self.imageView.translatesAutoresizingMaskIntoConstraints = true 113 | self.imageView.contentMode = .scaleAspectFit 114 | self.imageView.clipsToBounds = true 115 | 116 | DispatchQueue.main.async { 117 | self.leftView = self.imageView 118 | self.leftViewMode = .always 119 | } 120 | 121 | } 122 | 123 | @objc func enablePasswordVisibilityToggle() { 124 | isSecureTextEntry.toggle() 125 | if isSecureTextEntry { 126 | self.button.setImage(UIImage(named: "ic_show"), for: .normal) 127 | }else{ 128 | self.button.setImage(UIImage(named: "ic_hide"), for: .normal) 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /FloatingLabelInput/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /FloatingLabelInput/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // FloatingLabelInput 4 | // 5 | // Created by Sprinthub on 08/10/2019. 6 | // Copyright © 2019 Sprinthub Mobile. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | 14 | @IBOutlet weak var usernameInput: FloatingLabelInput! 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | // Do any additional setup after loading the view. 19 | self.hideKeyboardOnTapAround() 20 | self.usernameInput.becomeFirstResponder() 21 | } 22 | 23 | func hideKeyboardOnTapAround() { 24 | let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(self.hideKeyboard)) 25 | tap.cancelsTouchesInView = false 26 | self.view.addGestureRecognizer(tap) 27 | } 28 | 29 | @objc func hideKeyboard() { 30 | self.view.endEditing(true) 31 | } 32 | } 33 | 34 | --------------------------------------------------------------------------------