Requires:x is T. In particular, in -O builds, no test is
performed to ensure that x actually has dynamic type T.
Warning: Trades safety for performance. Use unsafeDowncast
only when x as T has proven to be a performance problem and you
are confident that, always, x is T. It is better than an
unsafeBitCast because it's more restrictive, and because
checking is still performed in debug builds.
returns:
x as T
.Requires:
x is T
. In particular, in -O builds, no test is performed to ensure thatx
actually has dynamic typeT
.Warning: Trades safety for performance. Use
unsafeDowncast
only whenx as T
has proven to be a performance problem and you are confident that, always,x is T
. It is better than anunsafeBitCast
because it's more restrictive, and because checking is still performed in debug builds.Declaration
func
unsafeDowncast
<
T
:
AnyObject
>
(
x
:
AnyObject
) -
>
T