[Swift]メモリアドレス取得

メモリアドレス取得

func getMemoryAddress(target:AnyObject) -> String {
    return "\(unsafeAddressOf(target))"
}
let m1:String = self.getMemoryAddress(self.view1)
let m2:String = self.getMemoryAddress(self.view2)
println("mem:\(m1)")
println("mem:\(m2)")
println("m1 < m2 = \(m1 < m2)")
println("m2 < m1 = \(m2 < m1)")

結果

mem:0x00007fe718c4da20
mem:0x00007fe718c42f20
m1 < m2 = false
m2 < m1 = true