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.
		
		
		
		
		
			
		
			
				
	
	
		
			40 lines
		
	
	
		
			861 B
		
	
	
	
		
			Swift
		
	
			
		
		
	
	
			40 lines
		
	
	
		
			861 B
		
	
	
	
		
			Swift
		
	
| //  Copyright (c) 2020 Open Whisper Systems. All rights reserved.
 | |
| 
 | |
| import UIKit
 | |
| import SessionUIKit
 | |
| 
 | |
| public class CircleView: UIView {
 | |
| 
 | |
|     @available(*, unavailable, message:"use other constructor instead.")
 | |
|     required public init?(coder aDecoder: NSCoder) {
 | |
|         fatalError("init(coder:) has not been implemented")
 | |
|     }
 | |
| 
 | |
|     public required init() {
 | |
|         super.init(frame: .zero)
 | |
|     }
 | |
| 
 | |
|     public required init(diameter: CGFloat) {
 | |
|         super.init(frame: .zero)
 | |
| 
 | |
|         set(.width, to: diameter)
 | |
|         set(.height, to: diameter)
 | |
|     }
 | |
| 
 | |
|     override public var frame: CGRect {
 | |
|         didSet {
 | |
|             updateRadius()
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     override public var bounds: CGRect {
 | |
|         didSet {
 | |
|             updateRadius()
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     private func updateRadius() {
 | |
|         self.layer.cornerRadius = self.bounds.size.height / 2
 | |
|     }
 | |
| }
 |