xcode - Arrays and Swift -


I am trying to deal with an app in Swift and I'm experiencing the following error using the array Fatal error: Out of range index range

it appears that when an app assigns a value to index 0:

Dracin: square: {init (CGSize size) {super.init (size: size)} var line = SKShapeNode () var path = CGPathCreateMutable () var touch: UITouch! Var pts = [CGPoint] () touches the override function (touch: nsset, event event: uievent) {/ * when touch starts / touch / touch.onebase ()) as UIT! Self.pts [0] = touch.locationInNode (self) & lt; - Error appears here DrawLine ()}

Some thoughts? (I'm using Xcode 6 Beta 4)

Your array is already empty.

  if self.pts.isEmpty {self.pts.append (touch.locationInNode (self)}} other {self.pts [0] = touch.locationInNode (self)}  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -