What you're describing is an overload. You just express it as two functions, where one chains to the more general version.
// Specialized version; a one-element list
func hiWorld(passedVar: String) {
hiWorld(passedVar: [passedVar])
}
// general version; list of any length
func hiWorld(passedVar: [String]) {
print(passedVar)
}
(In practice, this is often how you wind up implementing it in TypeScript as well, since you can't generally do the same things with all types. Your print example is very special and misleading case.)
The syntax you're describing is an algebraic data type, and Swift doesn't support that syntax directly. While it can be a convenient shortcut, Swift generally prefers using an explicit enum or a protocol in cases where this kind of overload wouldn't make sense.
Stringversion.Array.map(_:)andArray.forEach(_:)let you convert every function that takes a single element into a function that can take an array of elements, without needing multiple overloadsand rejecting if both are nilThat's probably a misplaced responsibility. Unwrapping optionals should be done on the caller's side, not in the callee.