17

I have created one of my application in swift 2 in Xcode 7.3.1. But now I have open same application in Xcode 8.0 and perform changes. Some automatic changes are done and some errors and suggestions shown I have corrected them. But I am facing issue that

let path = CGMutablePath()
CGPathMoveToPoint(path, nil, lineFrame.midX, lineFrame.midY)
CGPathAddLineToPoint(path, nil, lineFrame.origin.x + lineFrame.width / 2, lineFrame.origin.y)

I tried to create path, but shows error that

  1. CGPathMoveToPoint is unavailable: Use move(to:transform:)
  2. CGPathAddLineToPoint is unavailable: Use addLine(to:transform:)

If anyone have solution, please let me know.

VRAwesome
  • 4,721
  • 5
  • 27
  • 52

1 Answers1

41

Try this:

    let path = CGMutablePath()
    path.move(to: CGPoint(x: lineFrame.midX, y: lineFrame.midY))
    path.addLine(to: CGPoint(x: lineFrame.origin.x + lineFrame.width / 2, y: lineFrame.origin.y))

And check the latest reference of CGMutablePath:

CGMutablePath

OOPer
  • 47,149
  • 6
  • 107
  • 142
  • 2
    @VRAwesome, that may happen. Please remember you can write an answer by yourself (and accept it later). Good luck for you and for your app. – OOPer Sep 15 '16 at 11:16