Files
swift-mirror/test/stdlib/Bridgeable.swift
Joe Groff f6d4485a3c stdlib/runtime: Create an _ObjCBridgeable protocol and 'bridgeAny' runtime function.
For container bridging, implement a '_bridge<T>' function that converts a Swift value to AnyObject using a runtime check for its _ObjCBridgeable conformance, crashing if one doesn't exist.

Swift SVN r14645
2014-03-04 16:50:11 +00:00

15 lines
201 B
Swift

// RUN: %target-run-simple-swift | FileCheck %s
class C {}
struct Foo: _ObjCBridgeable {
func _bridge() -> AnyObject {
return C()
}
}
// CHECK: ok
if _bridge(Foo()) as C {
println("ok")
}