// NOTE: @schwa figured this out, but I'm claiming some of the credit for asking the question. // See https://gist.github.com/schwa/ecd5f8c154e60fcb0f58 for the original solution. // Playground - noun: a place where people can play import Foundation // Implementation (repeat as needed for number of parameters). func unwrap(p1: T1?, p2: T2?) -> (T1, T2)? { // return p1 && p2 ? (p1!, p2!) : nil if p1 && p2 { return (p1!, p2!) } return nil } func unwrap(p1: T1?, p2: T2?, p3: T3?) -> (T1, T2, T3)? { // return p1 && p2 && p3 ? (p1!, p2!, p3!) : nil if p1 && p2 && p3 { return (p1!, p2!, p3!) } return nil } // Example var a: String? = "A" var b: String? = "B" var c: String? = "C" // New hotness if let (x, y, z) = unwrap(a, b, c) { x y z } else { "There was at least one nil" } // Old and busted if a && b && c { let (x, y, z) = (a!, b!, c!) x y z } else { "There was at least on nil" }