Tim Nuwin Tim Nuwin - 6 months ago 32
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?


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