diff --git a/Example/Authenticator.xcodeproj/project.pbxproj b/Example/Authenticator.xcodeproj/project.pbxproj index aac3f60e..c25bb3fc 100644 --- a/Example/Authenticator.xcodeproj/project.pbxproj +++ b/Example/Authenticator.xcodeproj/project.pbxproj @@ -2220,7 +2220,7 @@ CODE_SIGN_ENTITLEMENTS = Authenticator_Example.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 129; + CURRENT_PROJECT_VERSION = 130; DEVELOPMENT_TEAM = ""; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; @@ -2247,7 +2247,7 @@ CODE_SIGN_ENTITLEMENTS = Authenticator_Example.entitlements; CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 129; + CURRENT_PROJECT_VERSION = 130; DEVELOPMENT_TEAM = ""; EXCLUDED_ARCHS = ""; "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64; diff --git a/Example/Authenticator/Assets.xcassets/Colors/Contents.json b/Example/Authenticator/Assets.xcassets/Colors/Contents.json index da4a164c..73c00596 100644 --- a/Example/Authenticator/Assets.xcassets/Colors/Contents.json +++ b/Example/Authenticator/Assets.xcassets/Colors/Contents.json @@ -1,6 +1,6 @@ { "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/Example/Authenticator/Assets.xcassets/Colors/shadow.colorset/Contents.json b/Example/Authenticator/Assets.xcassets/Colors/shadow.colorset/Contents.json new file mode 100644 index 00000000..5e4798cd --- /dev/null +++ b/Example/Authenticator/Assets.xcassets/Colors/shadow.colorset/Contents.json @@ -0,0 +1,20 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0.179", + "green" : "0.126", + "red" : "0.056" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Example/Authenticator/Utils/Extensions/ColorExtensions.swift b/Example/Authenticator/Utils/Extensions/ColorExtensions.swift index 7860c3d3..21d47321 100644 --- a/Example/Authenticator/Utils/Extensions/ColorExtensions.swift +++ b/Example/Authenticator/Utils/Extensions/ColorExtensions.swift @@ -82,4 +82,8 @@ extension UIColor { static var redAlert: UIColor { return UIColor(named: "redAlert", in: .authenticator_main, compatibleWith: nil)! } + + static var shadow: UIColor { + return UIColor(named: "shadow", in: .authenticator_main, compatibleWith: nil)! + } } diff --git a/Example/Authenticator/Views/Components/CustomButton.swift b/Example/Authenticator/Views/Components/CustomButton.swift index a457f90c..e3ff3217 100644 --- a/Example/Authenticator/Views/Components/CustomButton.swift +++ b/Example/Authenticator/Views/Components/CustomButton.swift @@ -37,6 +37,19 @@ class CustomButton: UIButton { } } + override func layoutSubviews() { + super.layoutSubviews() + layer.shadowPath = UIBezierPath(rect: bounds).cgPath + layer.shouldRasterize = true + layer.rasterizationScale = UIScreen.main.scale + layer.shadowColor = UIColor.shadow.cgColor + layer.shadowOffset = CGSize(width: 0, height: 6) + layer.shadowOpacity = 0.2 + layer.shadowRadius = 10.0 + layer.shouldRasterize = true + layer.rasterizationScale = UIScreen.main.scale + } + init(text: String, height: CGFloat = Layout.height, textColor: UIColor = .white, backgroundColor: UIColor = .darkBlue) { super.init(frame: .zero) self.backgroundColor = backgroundColor @@ -46,23 +59,12 @@ class CustomButton: UIButton { setTitleColor(textColor, for: .highlighted) layer.cornerRadius = Layout.cornerRadius self.height(height) - setupShadow() } func updateTitle(text: String) { setTitle(text, for: .normal) } - private func setupShadow() { - layer.shadowPath = UIBezierPath(rect: bounds).cgPath - layer.shouldRasterize = true - layer.rasterizationScale = UIScreen.main.scale - layer.shadowColor = UIColor(red: 0.051, green: 0.576, blue: 0.973, alpha: 0.2).cgColor - layer.shadowOffset = CGSize(width: 0, height: 6) - layer.shadowOpacity = 0.7 - layer.shadowRadius = 30.0 - } - required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } diff --git a/Example/Authenticator/Views/Components/RoundedShadowView.swift b/Example/Authenticator/Views/Components/RoundedShadowView.swift index 027fd3c8..1cdee312 100644 --- a/Example/Authenticator/Views/Components/RoundedShadowView.swift +++ b/Example/Authenticator/Views/Components/RoundedShadowView.swift @@ -51,9 +51,10 @@ class RoundedShadowView: UIView { shadowLayer.shadowColor = UIColor(red: 0.056, green: 0.126, blue: 0.179, alpha: 0.12).cgColor shadowLayer.shadowPath = shadowLayer.path - shadowLayer.shadowOffset = CGSize(width: 0, height: 8) - shadowLayer.shadowOpacity = 0.9 - shadowLayer.shadowRadius = 26 + shadowLayer.shadowOffset = .zero + shadowLayer.shadowOpacity = 0.7 + shadowLayer.shadowRadius = 8 + shadowLayer.shadowPath = UIBezierPath(rect: bounds).cgPath layer.insertSublayer(shadowLayer, at: 0) }