Tim Nuwin Tim Nuwin - 1 year ago 93
Swift Question

How do I return if let doesn't unwrap, using legacy swift

The guard line throws this error

using legacy swift: Initializer for conditional binding must have
Optional type, not 'UIView'

private func animateDismissal(context: UIViewControllerContextTransitioning) {

guard let containerView = context.containerView() else {

How do I return if let doesn't unwrap?

Answer Source

context.containerView() is not optional, so it cant be nil. So no need to guard or unwrap it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download