 		
 		var glyphOffset:CGFloat = 0
 		
-		for run in runs {
-			
+        for runIndex in 0 ..< CFArrayGetCount(runs) {
+			let run: CTRunRef = unsafeBitCast(CFArrayGetValueAtIndex(runs, runIndex), CTRunRef.self)
 			let runCount = CTRunGetGlyphCount(run)
 			
 			var advances = UnsafeMutablePointer<CGSize>(malloc((sizeof(CGSize))*runCount))


				let length = length - (samples[i-1].length + len1)

				let deltaAngle = arcFi(samples[i+1].angle, samples[i].angle)
				let orientation = (compareAngles(samples[i+1].angle-CGFloat.Pi/2, samples[i+1].angle, samples[i].angle) > 0 ? -1 : 1)
				
				return samples[i].angle + deltaAngle * CGFloat(orientation) * (min(1, length/len1) + max(0, (length-len1)/len2)) / 2
			}

		
		UIGraphicsBeginImageContextWithOptions(imageSize, false, 0)
		
		self.drawAttributedString(string, toContext: UIGraphicsGetCurrentContext()!, align: alignment, yOffset: yOffset)
		
		let image = UIGraphicsGetImageFromCurrentImageContext()
		UIGraphicsEndImageContext()
