Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import Cocoa
var str = "Hello, playground"
let ptr = UnsafeRawPointer(str)
let origin = CGPoint(x: 0, y: 0)
var other = origin
other.x += 10
var another = origin
another.y += 5
var addressO = UnsafeMutablePointer<CGPoint>(&other)
var addressA = UnsafeMutablePointer<CGPoint>(&another)
func swapPoint(pointA : inout CGPoint, pointB : inout CGPoint) {
let temp = pointA
pointA = pointB
pointB = temp
}
swapPoint(pointA: &other, pointB: &another)
var addressO1 = UnsafeMutablePointer<CGPoint>(&other)
var addressA2 = UnsafeMutablePointer<CGPoint>(&another)
print(other, another)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment