Files
Woka_Native_iOS/WOKA/Helpers/UIElements Helper/TextFieldShadow.swift
Bilal 334dc39dda - Implemented UserQuery API with post and error handling with checks
- Implemented the logic for Guest Query.
- Added api for guest contact support
- Finalised the logic for the user guest and normal.
- Completed Profile UI
- Updated the profile from the getuserdata
- Added API for Profile update
2024-06-05 20:00:10 +05:30

70 lines
2.0 KiB
Swift

//
// TextFieldShadow.swift
// WOKA
//
// Created by MacBook Pro on 29/04/24.
//
import UIKit
class TextFieldShadow: UITextField {
lazy var innerShadow: CALayer = {
let innerShadow = CALayer()
layer.addSublayer(innerShadow)
return innerShadow
}()
override func layoutSubviews() {
super.layoutSubviews()
applyDesign()
}
func applyDesign() {
innerShadow.frame = bounds
// Shadow path (1pt ring around bounds)
let radius = self.frame.size.height/2
let path = UIBezierPath(roundedRect: innerShadow.bounds.insetBy(dx: -1, dy:-1), cornerRadius:radius)
let cutout = UIBezierPath(roundedRect: innerShadow.bounds, cornerRadius:radius).reversing()
path.append(cutout)
innerShadow.shadowPath = path.cgPath
innerShadow.masksToBounds = true
// Shadow properties
innerShadow.shadowColor = UIColor.black.cgColor
innerShadow.shadowOffset = CGSize(width: 0, height: 1.2)
innerShadow.shadowOpacity = 0.8
innerShadow.shadowRadius = 2
innerShadow.cornerRadius = self.frame.size.height/2
}
}
extension UIView {
func applyInnerShadow(radius : CGFloat) {
let innerShadow = CALayer()
layer.addSublayer(innerShadow)
// Inner shadow setup
innerShadow.frame = bounds
// Shadow path (1pt ring around bounds)
let radius = radius
let path = UIBezierPath(roundedRect: innerShadow.bounds.insetBy(dx: -1, dy: -1), cornerRadius: radius)
let cutout = UIBezierPath(roundedRect: innerShadow.bounds, cornerRadius: radius).reversing()
path.append(cutout)
innerShadow.shadowPath = path.cgPath
innerShadow.masksToBounds = true
// Shadow properties
innerShadow.shadowColor = UIColor.black.cgColor
innerShadow.shadowOffset = CGSize(width: 0, height: 1.2)
innerShadow.shadowOpacity = 0.8
innerShadow.shadowRadius = 2
innerShadow.cornerRadius = radius
}
}