swift 원형 프로그레스 제작
import UIKit class CircleProgress: UIView { // 전역변수 let circle = CAShapeLayer () let pause = CAShapeLayer () let progress = CAShapeLayer () let mask = CAShapeLayer () let black = UIColor . blackColor (). CGColor // 초기값 var value: CGFloat = 0.0 required init ?(coder: NSCoder ) { super . init (coder: coder) Start () } override init (frame: CGRect ) { super . init (frame: frame) Start () } func Start() { // 크기 let rect = self . bounds let pauseRect = rect. insetBy (dx: rect. width / 3 , dy: rect. height / 3 ) let radius = min (rect. width , rect. height ) / 2 let center = CGPoint (x: rect. midX , y: rect. midY ) // 레이어 추가 for layer in [ progress , pause , circle ] { layer. strokeColor = black layer. fillColor = nil