Hi Rick,
I think you’re looking for something like this? Assuming when you say “return”
in your bullet spec you mean assign-in-place since we’re talking about +=
func +=(lhs: inout [T]?, rhs: [T]?) {
switch (lhs,rhs) {
case (_,nil): return // no-op whether lhs
When working with URLComponents query items, it would be nice to write code
like this:
var oqi: [URLQueryItem]? = [..., ..., ...]
var comps = URLComponents(…)
comps.queryItems += oqi
The problem is that queryItems is [URLQueryItem]?, and so I can't just append.
I'd like to write a version of +