Can anybody explain how to access CMutablePointer<CGPoint>
presented below? I can't find the syntax for it. It used to be ->
in Objective-C
, but here none of my solutions works. The solution presented in this link works in the opposite way I need to find out.
func scrollViewWillEndDragging(scrollView: UIScrollView!, withVelocity velocity: CGPoint, targetContentOffset: CMutablePointer<CGPoint>) { let newPage = targetContentOffset->x + 1; }
As @Eric mentioned in his update, the scrollViewWillEndDragging delegate now takes an UnsafePointer. To update the Unsafe pointer, you just have to access the memory property.
func scrollViewWillEndDragging(scrollView: UIScrollView!, withVelocity velocity: CGPoint, targetContentOffset: UnsafePointer<CGPoint>) { targetContentOffset.memory.y = x + 1 }
*Tested and working with Swift Beta 4.
UPDATED FOR BETA 5
Swift Beta 5 scroll view delegate uses an UnsafeMutablePointer instead of UnSafePointer
func scrollViewWillEndDragging(scrollView: UIScrollView!, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { targetContentOffset.memory.y = x+ 1 }
Since Swift beta 5, scrollViewWillEndDragging(_:withVelocity:targetContentOffset:)
has taken an UnsafeMutablePointer
instance as its last argument. When this method is called by your scroll view, your implementation can access the underlying Core Graphics point through the pointer's pointee
property.
Note that the spelling of pointee
used to be memory
before Swift 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With