title: Swift - Create circle and add to array
body: <p>I've been looking for a little while on how to create a circle in Swift, but it seems quite complicated. I want to create a circle at run time, with a specified x and y, and width and height. I then want to add this circle to an array where I can create more circles and add to it.</p>
  
  <p>How do I do this?</p>
  
  <p>Edit: This is what I've tried so far:</p>
  
  <pre><code>var center : CGPoint = touchLocation
  
  var myContext : CGContextRef = UIGraphicsGetCurrentContext()
  
  let color : [CGFloat] = [0, 0, 1, 0.5]
  CGContextSetStrokeColor (myContext, color);
  CGContextStrokeEllipseInRect (myContext, CGRectMake(touchLocation.x, touchLocation.y, 20, 20));
  </code></pre>
  
  <p>touchLocation is the location of the users finger. This crashes on execution on this line:</p>
  
  <pre><code>var myContext : CGContextRef = UIGraphicsGetCurrentContext()
  </code></pre>
  
  <p>The error says "Unexpectedly found nil while unwrapping an Optional value</p>
  
  <p>Also, this doesn't allow me to add the circle to an array, because I don't know what variable type it is.</p>