Since when do I need to use '.pointee' instead of '.memory' to access the data of an UnsafeMutable pointer?

I experienced this in the following method:

    override func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
		print(targetContentOffset.pointee.x)
	}

The tutorial that I was following used targetContentOffset.memory.x while I had to use targetContentOffset.pointee.x

Was this a change in Swift of how come that this happened?

This happened "way back" in Swift 3 as part of SE-0006: Apply API Guidelines to the Standard Library.

2 Likes

Oh yeah right, my bad! Thanks for the intel :grinning: