├── Neumorphic-View.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── lygon.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Neumorphic-View ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── NeumorphicView.swift ├── SceneDelegate.swift └── ViewController.swift └── README.md /Neumorphic-View.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C7BDD333251AE3440058D0B4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BDD332251AE3440058D0B4 /* AppDelegate.swift */; }; 11 | C7BDD335251AE3440058D0B4 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BDD334251AE3440058D0B4 /* SceneDelegate.swift */; }; 12 | C7BDD337251AE3440058D0B4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7BDD336251AE3440058D0B4 /* ViewController.swift */; }; 13 | C7BDD33A251AE3440058D0B4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7BDD338251AE3440058D0B4 /* Main.storyboard */; }; 14 | C7BDD33C251AE3440058D0B4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C7BDD33B251AE3440058D0B4 /* Assets.xcassets */; }; 15 | C7BDD33F251AE3440058D0B4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C7BDD33D251AE3440058D0B4 /* LaunchScreen.storyboard */; }; 16 | C7D420C0251C8709006C19E5 /* NeumorphicView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7D420BF251C8709006C19E5 /* NeumorphicView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | C7BDD32F251AE3440058D0B4 /* Neumorphic-View.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Neumorphic-View.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | C7BDD332251AE3440058D0B4 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | C7BDD334251AE3440058D0B4 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 23 | C7BDD336251AE3440058D0B4 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | C7BDD339251AE3440058D0B4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | C7BDD33B251AE3440058D0B4 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | C7BDD33E251AE3440058D0B4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | C7BDD340251AE3440058D0B4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | C7D420BF251C8709006C19E5 /* NeumorphicView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NeumorphicView.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | C7BDD32C251AE3440058D0B4 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | C7BDD326251AE3440058D0B4 = { 43 | isa = PBXGroup; 44 | children = ( 45 | C7BDD331251AE3440058D0B4 /* Neumorphic-View */, 46 | C7BDD330251AE3440058D0B4 /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | C7BDD330251AE3440058D0B4 /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | C7BDD32F251AE3440058D0B4 /* Neumorphic-View.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | C7BDD331251AE3440058D0B4 /* Neumorphic-View */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | C7BDD332251AE3440058D0B4 /* AppDelegate.swift */, 62 | C7BDD334251AE3440058D0B4 /* SceneDelegate.swift */, 63 | C7BDD336251AE3440058D0B4 /* ViewController.swift */, 64 | C7D420BF251C8709006C19E5 /* NeumorphicView.swift */, 65 | C7BDD338251AE3440058D0B4 /* Main.storyboard */, 66 | C7BDD33B251AE3440058D0B4 /* Assets.xcassets */, 67 | C7BDD33D251AE3440058D0B4 /* LaunchScreen.storyboard */, 68 | C7BDD340251AE3440058D0B4 /* Info.plist */, 69 | ); 70 | path = "Neumorphic-View"; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | C7BDD32E251AE3440058D0B4 /* Neumorphic-View */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = C7BDD343251AE3440058D0B4 /* Build configuration list for PBXNativeTarget "Neumorphic-View" */; 79 | buildPhases = ( 80 | C7BDD32B251AE3440058D0B4 /* Sources */, 81 | C7BDD32C251AE3440058D0B4 /* Frameworks */, 82 | C7BDD32D251AE3440058D0B4 /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = "Neumorphic-View"; 89 | productName = "Neumorphic-View"; 90 | productReference = C7BDD32F251AE3440058D0B4 /* Neumorphic-View.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | C7BDD327251AE3440058D0B4 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 1160; 100 | LastUpgradeCheck = 1160; 101 | ORGANIZATIONNAME = Yonghyun; 102 | TargetAttributes = { 103 | C7BDD32E251AE3440058D0B4 = { 104 | CreatedOnToolsVersion = 11.6; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = C7BDD32A251AE3440058D0B4 /* Build configuration list for PBXProject "Neumorphic-View" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = C7BDD326251AE3440058D0B4; 117 | productRefGroup = C7BDD330251AE3440058D0B4 /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | C7BDD32E251AE3440058D0B4 /* Neumorphic-View */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | C7BDD32D251AE3440058D0B4 /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | C7BDD33F251AE3440058D0B4 /* LaunchScreen.storyboard in Resources */, 132 | C7BDD33C251AE3440058D0B4 /* Assets.xcassets in Resources */, 133 | C7BDD33A251AE3440058D0B4 /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | C7BDD32B251AE3440058D0B4 /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | C7D420C0251C8709006C19E5 /* NeumorphicView.swift in Sources */, 145 | C7BDD337251AE3440058D0B4 /* ViewController.swift in Sources */, 146 | C7BDD333251AE3440058D0B4 /* AppDelegate.swift in Sources */, 147 | C7BDD335251AE3440058D0B4 /* SceneDelegate.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | C7BDD338251AE3440058D0B4 /* Main.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | C7BDD339251AE3440058D0B4 /* Base */, 158 | ); 159 | name = Main.storyboard; 160 | sourceTree = ""; 161 | }; 162 | C7BDD33D251AE3440058D0B4 /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | C7BDD33E251AE3440058D0B4 /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | C7BDD341251AE3440058D0B4 /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 200 | CLANG_WARN_STRICT_PROTOTYPES = YES; 201 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 203 | CLANG_WARN_UNREACHABLE_CODE = YES; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | COPY_PHASE_STRIP = NO; 206 | DEBUG_INFORMATION_FORMAT = dwarf; 207 | ENABLE_STRICT_OBJC_MSGSEND = YES; 208 | ENABLE_TESTABILITY = YES; 209 | GCC_C_LANGUAGE_STANDARD = gnu11; 210 | GCC_DYNAMIC_NO_PIC = NO; 211 | GCC_NO_COMMON_BLOCKS = YES; 212 | GCC_OPTIMIZATION_LEVEL = 0; 213 | GCC_PREPROCESSOR_DEFINITIONS = ( 214 | "DEBUG=1", 215 | "$(inherited)", 216 | ); 217 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 218 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 219 | GCC_WARN_UNDECLARED_SELECTOR = YES; 220 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 221 | GCC_WARN_UNUSED_FUNCTION = YES; 222 | GCC_WARN_UNUSED_VARIABLE = YES; 223 | IPHONEOS_DEPLOYMENT_TARGET = 13.6; 224 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 225 | MTL_FAST_MATH = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 230 | }; 231 | name = Debug; 232 | }; 233 | C7BDD342251AE3440058D0B4 /* Release */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_ANALYZER_NONNULL = YES; 238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_ENABLE_OBJC_WEAK = YES; 244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_COMMA = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu11; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 13.6; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | MTL_FAST_MATH = YES; 280 | SDKROOT = iphoneos; 281 | SWIFT_COMPILATION_MODE = wholemodule; 282 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | C7BDD344251AE3440058D0B4 /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CODE_SIGN_STYLE = Automatic; 292 | DEVELOPMENT_TEAM = 5WP2UJAGJQ; 293 | INFOPLIST_FILE = "Neumorphic-View/Info.plist"; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = "lygon.Neumorphic-View"; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_VERSION = 5.0; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | }; 303 | name = Debug; 304 | }; 305 | C7BDD345251AE3440058D0B4 /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | CODE_SIGN_STYLE = Automatic; 310 | DEVELOPMENT_TEAM = 5WP2UJAGJQ; 311 | INFOPLIST_FILE = "Neumorphic-View/Info.plist"; 312 | LD_RUNPATH_SEARCH_PATHS = ( 313 | "$(inherited)", 314 | "@executable_path/Frameworks", 315 | ); 316 | PRODUCT_BUNDLE_IDENTIFIER = "lygon.Neumorphic-View"; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 5.0; 319 | TARGETED_DEVICE_FAMILY = "1,2"; 320 | }; 321 | name = Release; 322 | }; 323 | /* End XCBuildConfiguration section */ 324 | 325 | /* Begin XCConfigurationList section */ 326 | C7BDD32A251AE3440058D0B4 /* Build configuration list for PBXProject "Neumorphic-View" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | C7BDD341251AE3440058D0B4 /* Debug */, 330 | C7BDD342251AE3440058D0B4 /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | C7BDD343251AE3440058D0B4 /* Build configuration list for PBXNativeTarget "Neumorphic-View" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | C7BDD344251AE3440058D0B4 /* Debug */, 339 | C7BDD345251AE3440058D0B4 /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | /* End XCConfigurationList section */ 345 | }; 346 | rootObject = C7BDD327251AE3440058D0B4 /* Project object */; 347 | } 348 | -------------------------------------------------------------------------------- /Neumorphic-View.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Neumorphic-View.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Neumorphic-View.xcodeproj/xcuserdata/lygon.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Neumorphic-View.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Neumorphic-View/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Neumorphic-View 4 | // 5 | // Created by Yonghyun on 2020/09/23. 6 | // Copyright © 2020 Yonghyun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /Neumorphic-View/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Neumorphic-View/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Neumorphic-View/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 | -------------------------------------------------------------------------------- /Neumorphic-View/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 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 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 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | -------------------------------------------------------------------------------- /Neumorphic-View/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /Neumorphic-View/NeumorphicView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NeumorphicView.swift 3 | // Neumorphic-View 4 | // 5 | // Created by Yonghyun on 2020/09/24. 6 | // Copyright © 2020 Yonghyun. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import UIKit 11 | 12 | @IBDesignable 13 | class NeumorphicView: UIView { 14 | 15 | enum ShapeType: Int { 16 | case Flat = 0 17 | case Concave = 1 18 | case Convex = 2 19 | case Pressed = 3 20 | } 21 | 22 | enum DirectionType: Int { 23 | case TopLeft = 0 24 | case TopRight = 1 25 | case BottomLeft = 2 26 | case BottomRight = 3 27 | } 28 | 29 | var shadowPath0: UIBezierPath? 30 | var shadowPath1: UIBezierPath? 31 | var shadowLayer0: CALayer = CALayer() 32 | var shadowLayer1: CALayer = CALayer() 33 | var topLayer: CALayer = CALayer() 34 | var gradientLayer: CAGradientLayer = CAGradientLayer() 35 | var shape: ShapeType = .Flat 36 | var direction: DirectionType = .TopLeft 37 | var shadowIntensity: CGFloat = 0 38 | var shadowColor0: UIColor? 39 | var shadowColor1: UIColor? 40 | var gradientColor0: UIColor? 41 | var gradientColor1: UIColor? 42 | 43 | @IBInspectable var shapeType: Int { 44 | get { 45 | return self.shape.rawValue 46 | } 47 | 48 | set(shapeIndex) { 49 | if shapeIndex < 0 || shapeIndex > 3 { 50 | self.shape = ShapeType.Flat 51 | } 52 | else { 53 | self.shape = ShapeType(rawValue: shapeIndex) ?? ShapeType.Flat 54 | } 55 | } 56 | } 57 | 58 | @IBInspectable var directionType: Int { 59 | get { 60 | return self.direction.rawValue 61 | } 62 | 63 | set(directionIndex) { 64 | if directionIndex < 0 || directionIndex > 3 { 65 | self.direction = DirectionType.TopLeft 66 | } 67 | else { 68 | self.direction = DirectionType(rawValue: directionIndex) ?? DirectionType.TopLeft 69 | } 70 | } 71 | } 72 | 73 | @IBInspectable var cornerRadius: CGFloat { 74 | get { 75 | return layer.cornerRadius 76 | } 77 | set { 78 | layer.cornerRadius = newValue 79 | topLayer.cornerRadius = newValue 80 | gradientLayer.cornerRadius = newValue 81 | } 82 | } 83 | 84 | @IBInspectable var opacity: Float { 85 | get { 86 | return shadowLayer0.shadowOpacity 87 | } 88 | set { 89 | shadowLayer0.shadowOpacity = newValue 90 | shadowLayer1.shadowOpacity = newValue 91 | } 92 | } 93 | 94 | @IBInspectable var shadowRadius: CGFloat { 95 | get { 96 | return shadowLayer0.shadowRadius*2 97 | } 98 | set { 99 | shadowLayer0.shadowRadius = newValue/2 100 | shadowLayer1.shadowRadius = newValue/2 101 | } 102 | } 103 | 104 | @IBInspectable var offset: CGFloat { 105 | get { 106 | return shadowLayer0.shadowOffset.width 107 | } 108 | set { 109 | switch(shape) { 110 | case .Flat, .Concave, .Convex: 111 | switch(direction) { 112 | case .TopLeft: 113 | shadowLayer0.shadowOffset = CGSize(width: newValue, height: newValue) 114 | shadowLayer1.shadowOffset = CGSize(width: -newValue, height: -newValue) 115 | case .TopRight: 116 | shadowLayer0.shadowOffset = CGSize(width: -newValue, height: newValue) 117 | shadowLayer1.shadowOffset = CGSize(width: newValue, height: -newValue) 118 | case .BottomLeft: 119 | shadowLayer0.shadowOffset = CGSize(width: newValue, height: -newValue) 120 | shadowLayer1.shadowOffset = CGSize(width: -newValue, height: newValue) 121 | case .BottomRight: 122 | shadowLayer0.shadowOffset = CGSize(width: -newValue, height: -newValue) 123 | shadowLayer1.shadowOffset = CGSize(width: newValue, height: newValue) 124 | } 125 | case .Pressed: 126 | break 127 | } 128 | } 129 | } 130 | 131 | override var backgroundColor: UIColor? { 132 | didSet { 133 | topLayer.backgroundColor = self.backgroundColor?.cgColor 134 | } 135 | } 136 | 137 | @IBInspectable var intensity: CGFloat { 138 | get { 139 | return self.shadowIntensity 140 | } 141 | set { 142 | self.shadowIntensity = newValue 143 | 144 | let redValue = self.backgroundColor?.redComponent 145 | let greenValue = self.backgroundColor?.greenComponent 146 | let blueValue = self.backgroundColor?.blueComponent 147 | 148 | shadowColor0 = UIColor.init( 149 | red: redValue!-(newValue/255), 150 | green: greenValue!-(newValue/255), 151 | blue: blueValue!-(newValue/255), alpha: 1) 152 | 153 | shadowColor1 = UIColor.init( 154 | red: redValue!+(newValue/255), 155 | green: greenValue!+(newValue/255), 156 | blue: blueValue!+(newValue/255), alpha: 1) 157 | 158 | shadowLayer0.shadowColor = shadowColor0?.cgColor 159 | shadowLayer1.shadowColor = shadowColor1?.cgColor 160 | 161 | gradientColor0 = UIColor.init( 162 | red: redValue!-(25/255), 163 | green: greenValue!-(25/255), 164 | blue: blueValue!-(25/255), alpha: 1) 165 | 166 | gradientColor1 = UIColor.init( 167 | red: redValue!+(25/255), 168 | green: greenValue!+(25/255), 169 | blue: blueValue!+(25/255), alpha: 1) 170 | } 171 | } 172 | 173 | fileprivate func setup() { 174 | shadowPath0 = UIBezierPath(roundedRect: self.bounds, cornerRadius: cornerRadius) 175 | shadowLayer0.frame = self.bounds 176 | shadowLayer0.shadowPath = shadowPath0?.cgPath 177 | shadowLayer0.shadowColor = shadowColor0?.cgColor 178 | self.layer.insertSublayer(shadowLayer0, at: 0) 179 | 180 | shadowPath1 = UIBezierPath(roundedRect: self.bounds, cornerRadius: cornerRadius) 181 | shadowLayer1.frame = self.bounds 182 | shadowLayer1.shadowPath = shadowPath1?.cgPath 183 | shadowLayer1.shadowColor = shadowColor1?.cgColor 184 | self.layer.insertSublayer(shadowLayer1, at: 1) 185 | 186 | topLayer.frame = self.bounds 187 | self.layer.insertSublayer(topLayer, at: 2) 188 | 189 | self.layer.insertSublayer(gradientLayer, at: 3) 190 | 191 | switch(shape) { 192 | case .Flat: 193 | break 194 | case .Concave: 195 | gradientLayer.cornerRadius = self.cornerRadius 196 | gradientLayer.frame = self.bounds 197 | gradientLayer.colors = [ 198 | gradientColor0?.cgColor as Any, gradientColor1?.cgColor as Any 199 | ] 200 | gradientLayer.locations = [0, 1] 201 | self.layer.insertSublayer(gradientLayer, at: 3) 202 | 203 | switch(direction) { 204 | case .TopLeft: 205 | gradientLayer.startPoint = CGPoint(x: 0, y: 0) 206 | gradientLayer.endPoint = CGPoint(x: 1, y: 1) 207 | case .TopRight: 208 | gradientLayer.startPoint = CGPoint(x: 1, y: 0) 209 | gradientLayer.endPoint = CGPoint(x: 0, y: 1) 210 | case .BottomLeft: 211 | gradientLayer.startPoint = CGPoint(x: 0, y: 1) 212 | gradientLayer.endPoint = CGPoint(x: 1, y: 0) 213 | case .BottomRight: 214 | gradientLayer.startPoint = CGPoint(x: 1, y: 1) 215 | gradientLayer.endPoint = CGPoint(x: 0, y: 0) 216 | } 217 | case .Convex: 218 | gradientLayer.cornerRadius = self.cornerRadius 219 | gradientLayer.frame = self.bounds 220 | gradientLayer.colors = [ 221 | gradientColor1?.cgColor as Any, gradientColor0?.cgColor as Any 222 | ] 223 | gradientLayer.locations = [0, 1] 224 | self.layer.insertSublayer(gradientLayer, at: 3) 225 | 226 | switch(direction) { 227 | case .TopLeft: 228 | gradientLayer.startPoint = CGPoint(x: 0, y: 0) 229 | gradientLayer.endPoint = CGPoint(x: 1, y: 1) 230 | case .TopRight: 231 | gradientLayer.startPoint = CGPoint(x: 1, y: 0) 232 | gradientLayer.endPoint = CGPoint(x: 0, y: 1) 233 | case .BottomLeft: 234 | gradientLayer.startPoint = CGPoint(x: 0, y: 1) 235 | gradientLayer.endPoint = CGPoint(x: 1, y: 0) 236 | case .BottomRight: 237 | gradientLayer.startPoint = CGPoint(x: 1, y: 1) 238 | gradientLayer.endPoint = CGPoint(x: 0, y: 0) 239 | } 240 | case .Pressed: 241 | switch(direction) { 242 | case .TopLeft: 243 | self.addInnerShadow(onSide: .topAndLeft, shadowColor: shadowColor0!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 244 | self.addInnerShadow(onSide: .bottomAndRight, shadowColor: shadowColor1!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 245 | case .TopRight: 246 | self.addInnerShadow(onSide: .topAndRight, shadowColor: shadowColor0!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 247 | self.addInnerShadow(onSide: .bottomAndLeft, shadowColor: shadowColor1!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 248 | case .BottomLeft: 249 | self.addInnerShadow(onSide: .bottomAndLeft, shadowColor: shadowColor0!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 250 | self.addInnerShadow(onSide: .topAndRight, shadowColor: shadowColor1!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 251 | case .BottomRight: 252 | self.addInnerShadow(onSide: .bottomAndRight, shadowColor: shadowColor0!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 253 | self.addInnerShadow(onSide: .topAndLeft, shadowColor: shadowColor1!.cgColor, shadowSize: shadowRadius/2, cornerRadius: cornerRadius, shadowOpacity: opacity) 254 | } 255 | } 256 | } 257 | 258 | override func layoutSubviews() { 259 | super.layoutSubviews() 260 | setup() 261 | } 262 | 263 | override func prepareForInterfaceBuilder() { 264 | super.prepareForInterfaceBuilder() 265 | setup() 266 | } 267 | 268 | override init(frame: CGRect) { 269 | super.init(frame: frame) 270 | } 271 | 272 | required init?(coder aDecoder: NSCoder) { 273 | super.init(coder: aDecoder) 274 | } 275 | } 276 | 277 | extension UIColor { 278 | var rgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { 279 | var red: CGFloat = 0.0 280 | var green: CGFloat = 0.0 281 | var blue: CGFloat = 0.0 282 | var alpha: CGFloat = 0.0 283 | getRed(&red, green: &green, blue: &blue, alpha: &alpha) 284 | 285 | return (red: red, green: green, blue: blue, alpha: alpha) 286 | } 287 | 288 | var redComponent: CGFloat { 289 | var red: CGFloat = 0.0 290 | getRed(&red, green: nil, blue: nil, alpha: nil) 291 | 292 | return red 293 | } 294 | 295 | var greenComponent: CGFloat { 296 | var green: CGFloat = 0.0 297 | getRed(nil, green: &green, blue: nil, alpha: nil) 298 | 299 | return green 300 | } 301 | 302 | var blueComponent: CGFloat { 303 | var blue: CGFloat = 0.0 304 | getRed(nil, green: nil, blue: &blue, alpha: nil) 305 | 306 | return blue 307 | } 308 | 309 | var alphaComponent: CGFloat { 310 | var alpha: CGFloat = 0.0 311 | getRed(nil, green: nil, blue: nil, alpha: &alpha) 312 | 313 | return alpha 314 | } 315 | } 316 | 317 | extension UIColor { 318 | convenience init(red: Int, green: Int, blue: Int) { 319 | assert(red >= 0 && red <= 255, "Invalid red component") 320 | assert(green >= 0 && green <= 255, "Invalid green component") 321 | assert(blue >= 0 && blue <= 255, "Invalid blue component") 322 | 323 | self.init(red: CGFloat(red) / 255.0, green: CGFloat(green) / 255.0, blue: CGFloat(blue) / 255.0, alpha: 1.0) 324 | } 325 | 326 | convenience init(rgb: Int) { 327 | self.init( 328 | red: (rgb >> 16) & 0xFF, 329 | green: (rgb >> 8) & 0xFF, 330 | blue: rgb & 0xFF 331 | ) 332 | } 333 | 334 | static func contrastRatio(between color1: UIColor, and color2: UIColor) -> CGFloat { 335 | let luminance1 = color1.luminance() 336 | let luminance2 = color2.luminance() 337 | 338 | let luminanceDarker = min(luminance1, luminance2) 339 | let luminanceLighter = max(luminance1, luminance2) 340 | 341 | return (luminanceLighter + 0.05) / (luminanceDarker + 0.05) 342 | } 343 | 344 | func contrastRatio(with color: UIColor) -> CGFloat { 345 | return UIColor.contrastRatio(between: self, and: color) 346 | } 347 | 348 | func luminance() -> CGFloat { 349 | let ciColor = CIColor(color: self) 350 | 351 | func adjust(colorComponent: CGFloat) -> CGFloat { 352 | return (colorComponent < 0.04045) ? 353 | (colorComponent / 12.92) : pow((colorComponent + 0.055) / 1.055, 2.4) 354 | } 355 | 356 | return 0.2126 * adjust(colorComponent: ciColor.red) 357 | + 0.7152 * adjust(colorComponent: ciColor.green) 358 | + 0.0722 * adjust(colorComponent: ciColor.blue) 359 | } 360 | } 361 | 362 | extension UIView 363 | { 364 | public enum innerShadowSide 365 | { 366 | case all, left, right, top, bottom, topAndLeft, topAndRight, bottomAndLeft, bottomAndRight, exceptLeft, exceptRight, exceptTop, exceptBottom 367 | } 368 | 369 | public func addInnerShadow(onSide: innerShadowSide, shadowColor: CGColor, shadowSize: CGFloat, cornerRadius: CGFloat = 0.0, shadowOpacity: Float) 370 | { 371 | let shadowLayer = CAShapeLayer() 372 | shadowLayer.frame = bounds 373 | shadowLayer.shadowColor = shadowColor 374 | shadowLayer.shadowOffset = CGSize(width: 0.0, height: 0.0) 375 | shadowLayer.shadowOpacity = shadowOpacity 376 | shadowLayer.shadowRadius = shadowSize 377 | shadowLayer.fillRule = CAShapeLayerFillRule.evenOdd 378 | 379 | let shadowPath = CGMutablePath() 380 | let insetRect = bounds.insetBy(dx: -shadowSize * 2.0, dy: -shadowSize * 2.0) 381 | let innerFrame: CGRect = { () -> CGRect in 382 | switch onSide 383 | { 384 | case .all: 385 | return CGRect(x: 0.0, y: 0.0, width: frame.size.width, height: frame.size.height) 386 | case .left: 387 | return CGRect(x: 0.0, y: -shadowSize * 2.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 4.0) 388 | case .right: 389 | return CGRect(x: -shadowSize * 2.0, y: -shadowSize * 2.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 4.0) 390 | case .top: 391 | return CGRect(x: -shadowSize * 2.0, y: 0.0, width: frame.size.width + shadowSize * 4.0, height: frame.size.height + shadowSize * 2.0) 392 | case.bottom: 393 | return CGRect(x: -shadowSize * 2.0, y: -shadowSize * 2.0, width: frame.size.width + shadowSize * 4.0, height: frame.size.height + shadowSize * 2.0) 394 | case .topAndLeft: 395 | return CGRect(x: 0.0, y: 0.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 2.0) 396 | case .topAndRight: 397 | return CGRect(x: -shadowSize * 2.0, y: 0.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 2.0) 398 | case .bottomAndLeft: 399 | return CGRect(x: 0.0, y: -shadowSize * 2.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 2.0) 400 | case .bottomAndRight: 401 | return CGRect(x: -shadowSize * 2.0, y: -shadowSize * 2.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height + shadowSize * 2.0) 402 | case .exceptLeft: 403 | return CGRect(x: -shadowSize * 2.0, y: 0.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height) 404 | case .exceptRight: 405 | return CGRect(x: 0.0, y: 0.0, width: frame.size.width + shadowSize * 2.0, height: frame.size.height) 406 | case .exceptTop: 407 | return CGRect(x: 0.0, y: -shadowSize * 2.0, width: frame.size.width, height: frame.size.height + shadowSize * 2.0) 408 | case .exceptBottom: 409 | return CGRect(x: 0.0, y: 0.0, width: frame.size.width, height: frame.size.height + shadowSize * 2.0) 410 | } 411 | }() 412 | 413 | shadowPath.addRect(insetRect) 414 | shadowPath.addRect(innerFrame) 415 | shadowLayer.path = shadowPath 416 | layer.addSublayer(shadowLayer) 417 | clipsToBounds = true 418 | } 419 | } 420 | -------------------------------------------------------------------------------- /Neumorphic-View/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // Neumorphic-View 4 | // 5 | // Created by Yonghyun on 2020/09/23. 6 | // Copyright © 2020 Yonghyun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | } 22 | 23 | func sceneDidDisconnect(_ scene: UIScene) { 24 | // Called as the scene is being released by the system. 25 | // This occurs shortly after the scene enters the background, or when its session is discarded. 26 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 27 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 28 | } 29 | 30 | func sceneDidBecomeActive(_ scene: UIScene) { 31 | // Called when the scene has moved from an inactive state to an active state. 32 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 33 | } 34 | 35 | func sceneWillResignActive(_ scene: UIScene) { 36 | // Called when the scene will move from an active state to an inactive state. 37 | // This may occur due to temporary interruptions (ex. an incoming phone call). 38 | } 39 | 40 | func sceneWillEnterForeground(_ scene: UIScene) { 41 | // Called as the scene transitions from the background to the foreground. 42 | // Use this method to undo the changes made on entering the background. 43 | } 44 | 45 | func sceneDidEnterBackground(_ scene: UIScene) { 46 | // Called as the scene transitions from the foreground to the background. 47 | // Use this method to save data, release shared resources, and store enough scene-specific state information 48 | // to restore the scene back to its current state. 49 | } 50 | 51 | 52 | } 53 | 54 | -------------------------------------------------------------------------------- /Neumorphic-View/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Neumorphic-View 4 | // 5 | // Created by Yonghyun on 2020/09/23. 6 | // Copyright © 2020 Yonghyun. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet var neumorphicView: NeumorphicView! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | self.view.backgroundColor = neumorphicView.backgroundColor 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![스크린샷 2020-10-19 오후 4 17 50](https://user-images.githubusercontent.com/39911797/96413514-b6cede80-1226-11eb-9109-d0bf4d34e931.png) 2 | # Neumorphic-View 3 | With IBDesignable NeumorphicView Class, you can easily add neumorphic-views on storyboards. 4 | Inspired by Alexplyuto's Neumorphism design. 5 | 6 | # How to use 7 | 1. Add `NeumorphicView.swift` to your project folder or copy the code. 8 | 2. Go to your storyboard, and add an UIView. 9 | 3. Open the Identity Inspector and type `NeumorphicView` the Class field. 10 | ![스크린샷 2020-10-07 오후 3 43 14](https://user-images.githubusercontent.com/39911797/95297974-4931c280-08b6-11eb-989a-80a8ca1d0837.png) 11 | 4. On the Attributes Inspector, change the values whatever you want. 12 | ![스크린샷 2020-10-07 오후 3 43 21](https://user-images.githubusercontent.com/39911797/95297975-4931c280-08b6-11eb-906b-ca0b8826de4a.png) 13 | 14 | # Shape of View 15 | There are 4 types of shape. 16 | `Flat(0), Concave(1), Convex(2), Pressed(3)` 17 | Since Xcode doesn't support custom drop-down menu, you have to choose the type of shape by number. 18 | |![스크린샷 2020-10-07 오후 2 51 03](https://user-images.githubusercontent.com/39911797/95298108-8302c900-08b6-11eb-9071-f31a4d0c6c4d.png)|![스크린샷 2020-10-07 오후 2 51 11](https://user-images.githubusercontent.com/39911797/95298116-85fdb980-08b6-11eb-914a-65962d42fab6.png)|![스크린샷 2020-10-07 오후 2 51 18](https://user-images.githubusercontent.com/39911797/95298123-87c77d00-08b6-11eb-8e0c-cbd454157ce7.png)|![스크린샷 2020-10-07 오후 2 51 25](https://user-images.githubusercontent.com/39911797/95298126-89914080-08b6-11eb-8f35-0ca055f38719.png)| 19 | |:---:|:---:|:---:|:---:| 20 | |Flat|Concave|Convex|Pressed| 21 | 22 |
23 | 24 | # Direction of Shadow 25 | There are 4 types of direction. 26 | `Top-Left(0), Top-Right(1), Bottom-Left(2), Bottom-Right(3)` 27 | You also hvae to choose the type of direction by number. 28 | |![스크린샷 2020-10-07 오후 2 54 33](https://user-images.githubusercontent.com/39911797/95298468-16d49500-08b7-11eb-8b26-4c3fb4cd7acc.png)|![스크린샷 2020-10-07 오후 2 54 39](https://user-images.githubusercontent.com/39911797/95298481-1c31df80-08b7-11eb-97fa-7682ba7174ce.png)|![스크린샷 2020-10-07 오후 2 54 45](https://user-images.githubusercontent.com/39911797/95298489-1f2cd000-08b7-11eb-9cfd-a1bf68339baa.png)|![스크린샷 2020-10-07 오후 2 54 52](https://user-images.githubusercontent.com/39911797/95298495-20f69380-08b7-11eb-998a-f2cd5b17294c.png)| 29 | |:---:|:---:|:---:|:---:| 30 | |Top-Left|Top-Right|Bottom-Left|Bottom-Right| 31 | 32 |
33 | 34 | # Intensity of Shadow 35 | Opacity = 1, Shadow Radius = 25, Offset = 20 36 | Check the differences when only changing the value of intensity. 37 | |![스크린샷 2020-10-19 오전 10 57 29](https://user-images.githubusercontent.com/39911797/96393551-6c376d00-11fa-11eb-9912-f19b69b3bcea.png)|![스크린샷 2020-10-19 오전 10 57 35](https://user-images.githubusercontent.com/39911797/96393583-840ef100-11fa-11eb-8e9d-7102104d2ca3.png)|![스크린샷 2020-10-19 오전 10 57 42](https://user-images.githubusercontent.com/39911797/96393595-8e30ef80-11fa-11eb-8036-fc117512cb67.png)|![스크린샷 2020-10-19 오전 10 57 49](https://user-images.githubusercontent.com/39911797/96393604-9721c100-11fa-11eb-8a5f-5c9aad705e84.png)| 38 | |:---:|:---:|:---:|:---:| 39 | |Intensity = 10|Intensity = 20|Intensity = 30|Intensity = 40| 40 | 41 |
42 | 43 | # References 44 | * https://neumorphism.io/ 45 | * https://uxdesign.cc/neumorphism-in-user-interfaces-b47cef3bf3a6 46 | * https://medium.muz.li/skeuomorphism-neumorphism-ui-trend-e7b78792bd21 47 | --------------------------------------------------------------------------------