The wrapped value of this instance, unwrapped without checking whether the instance is
- Xcode 8.0+
- Swift Standard Library
unsafely property provides the same value as the forced unwrap operator (postfix
!). However, in optimized builds (
-O), no check is performed to ensure that the current instance actually has a value. Accessing this property in the case of a
nil value is a serious programming error and could lead to undefined behavior or a runtime error.
In debug builds (
unsafely property has the same behavior as using the postfix
! operator and triggers a runtime error if the instance is
unsafely property is recommended over calling the
unsafe function because the property is more restrictive and because accessing the property still performs checking in debug builds.