Why is 'nil' not compatible with 'UnsafePointerCGAffineTransform' in Swift 3?
Try this:
let path = CGMutablePath()
path.move(to: CGPoint(x: 30, y: 0))
CGPath APIs are now imported as instance methods in Swift 3.
You can check them with Command-clicking on CGMutablePath
.
Or see the latest reference of CGMutablePath.
CGPath not working in Swift 3
Most of the syntaxes are changed in Swift 3, But they didn't removed any API methods(like CGPathMoveToPoint) and It's just renamed like below.
let path = CGMutablePath()
path.move(to: CGPoint(x: 10.0, y: 10.0))
path.addLine(to: CGPoint(x: 10.0, y: 10.0))
UnsafePointerCGAffineTransform from CGAffineTransform
@Martin R provides the best answer, but as an alternative, I like to use my unsafe mutable pointers this way, in case you need to alter the actual pointer in the future
let path = withUnsafeMutablePointer(&transform)
{
CGPathCreateWithRect(CGRect(...), UnsafeMutablePointer($0))
}
Related Topics
How to Get Ip Address in Swift
How to Add Type Constraints to a Swift Protocol Conformance Extension
How to Use Special Character in Nsurl
Why Is Swift Compile Time So Slow
Swift 2 ( Executefetchrequest ): Error Handling
Realitykit VS Scenekit VS Metal - High-Quality Rendering
All Dates Between Two Date Objects (Swift)
Strange Swift Numbers Type Casting
When Are Argument Labels Required in Swift
Nsdate Timeintervalsince1970 Not Working in Swift
Firestore Search Array Contains For Multiple Values
Cfrunloop in Swift Command Line Program
How to Get the Data from Nsurlsession.Sharedsession().Datataskwithrequest