mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Swift
		
	
| 
 | |
| final class SettingRow : UIView {
 | |
|     private let autoSize: Bool
 | |
| 
 | |
|     lazy var contentView: UIView = {
 | |
|         let result = UIView()
 | |
|         result.backgroundColor = Colors.buttonBackground
 | |
|         result.layer.cornerRadius = 8
 | |
|         result.layer.masksToBounds = true
 | |
|         return result
 | |
|     }()
 | |
|     
 | |
|     private static let defaultHeight: CGFloat = 60
 | |
| 
 | |
|     init(autoSize: Bool) {
 | |
|         self.autoSize = autoSize
 | |
|         super.init(frame: CGRect.zero)
 | |
|         setUpUI()
 | |
|     }
 | |
| 
 | |
|     override init(frame: CGRect) {
 | |
|         autoSize = false
 | |
|         super.init(frame: frame)
 | |
|         setUpUI()
 | |
|     }
 | |
| 
 | |
|     required init?(coder: NSCoder) {
 | |
|         autoSize = false
 | |
|         super.init(coder: coder)
 | |
|         setUpUI()
 | |
|     }
 | |
| 
 | |
|     private func setUpUI() {
 | |
|         // Height
 | |
|         if !autoSize {
 | |
|             let height = SettingRow.defaultHeight
 | |
|             set(.height, to: height)
 | |
|         }
 | |
|         // Shadow
 | |
|         layer.shadowColor = UIColor.black.cgColor
 | |
|         layer.shadowOffset = CGSize.zero
 | |
|         layer.shadowOpacity = 0.4
 | |
|         layer.shadowRadius = 4
 | |
|         // Content view
 | |
|         addSubview(contentView)
 | |
|         contentView.pin(to: self)
 | |
|     }
 | |
| 
 | |
|     override func layoutSubviews() {
 | |
|         super.layoutSubviews()
 | |
|         layer.shadowPath = UIBezierPath(roundedRect: bounds, cornerRadius: 8).cgPath
 | |
|     }
 | |
| }
 |