title: UIBezier paths : How to divide the circle into multiple paths
body: <p>I am trying to divide the circle into multiple paths and represent data in it with few animation effects as shown in below image. Having trouble in dividing the paths. </p>
  
  <p>I appreciate any help &amp; suggestions.</p>
  
  <p><a href="https://i.stack.imgur.com/UOIUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UOIUO.png" alt="enter image description here"></a></p>
  
  <p>Code:</p>
  
  <pre><code>import UIKit
  
  class ViewController: UIViewController {
  
      //MARK:- Properties
      let total: Double = 10
      let categoryA: Double = 4
      let categoryB: Double = 3
      let categoryC: Double = 3
      var catAPer: Double!
      var catBPer: Double!
      var catCPer: Double!
  
      let radians: Double = (360 * .pi)/180
  
      //MARK:- IBOutlets
      @IBOutlet var circleView: UIView!
  
      override func viewDidLoad() {
          super.viewDidLoad()
          setupCircle()
          calibratePercentage()
          draw(circleView.frame)
      }
  
      override func didReceiveMemoryWarning() {
          super.didReceiveMemoryWarning()
      }
  
      func setupCircle() {
          let size: CGFloat = 240.0
          circleView.bounds = CGRect(x: 0, y: 0, width: size, height: size)
          circleView.layer.cornerRadius = size / 2
          circleView.layer.borderWidth = 1
          circleView.layer.borderColor = UIColor.gray.cgColor
          circleView.backgroundColor = UIColor.orange
      }
  
      func calibratePercentage() {
          catAPer = (categoryA/total)*100
          catBPer = (categoryB/total)*100
          catCPer = (categoryC/total)*100
          print((catAPer),(catBPer),(catCPer))
      }
  
      func draw(_ rect: CGRect) {
  
          let center = CGPoint(x:0,y:0)
  
          let portionPath1: UIBezierPath!
          portionPath1.move(to: center)
          portionPath1.addArc(withCenter: center, radius: 120, startAngle: radians(0), endAngle: radians(120), clockwise: true);
          portionPath1.close()
  
          portionPath1.fill(with: CGBlendMode.color, alpha: 1.0)
          portionPath1.fill()
  
          let portionPath2: UIBezierPath!
          portionPath1.move(to: center)
          portionPath1.addArc(withCenter: center, radius: 120, startAngle: radians(120), endAngle: radians(240), clockwise: true);
          portionPath1.close()
  
          portionPath1.fill(with: CGBlendMode.colorBurn, alpha: 1.0)
          portionPath1.fill()
  
          let portionPath3: UIBezierPath!
          portionPath1.move(to: center)
          portionPath1.addArc(withCenter: center, radius: 120, startAngle: radians(240), endAngle: radians(360), clockwise: true);
          portionPath1.close()
  
          portionPath1.fill(with: CGBlendMode.colorDodge, alpha: 1.0)
          portionPath1.fill()
      }
  
  
  }
  </code></pre>