title: Swift : drawing the dots in loop
body: <p>I am trying to draw multiple dots in a loop by passing set of points. But not a single dot is getting drawn on view. Idea - I am parsing xml document and extracting point to draw it on view.</p>
  
  <pre><code>   Edit - I have updated the code with suggested changes and it is working. 
  
              //View Class
              class DrawTrace: UIView
  {
  
      var points = [CGPoint]()
      {
          didSet {
              setNeedsDisplay()
          }
      }
  
  override  func draw(_ rect: CGRect)
      {
          let size = CGSize(width: 1, height: 1)
          UIColor.white.set()
          for point in points
          {
              print(point.x,point.y)
              let dot = UIBezierPath(ovalIn: CGRect(origin: point, size: size))
  
              dot.fill()
          }
      }
  
  
  
  }
   //View Controller Class  
  
      class ViewController: UIViewController
      {
          var object : traceDoc =  traceDoc()
          let trace = DrawTrace(frame: CGRect(x: 0, y: 0, width: 200, height: 200))
          override func viewDidLoad()
          {
  
              super.viewDidLoad()
              object.collectionOfData()
              trace.points = object.tracePoints
              self.view.addSubview(trace)
          }
      }
  </code></pre>
  
  <p>Added view instance to view hierarchy that is in view controller.Created instance of DrawTrace and appended to tracepoints array. </p>