Overlapping accesses to 'urlComponents', but modification requires exclusive access

I guess you need to set first to a local variable and then change it , try this:

var urlComponents = URLComponents(url: mutableURLRequest.url!, resolvingAgainstBaseURL: false) 
var localVariable = urlComponents 
urlComponents?.queryItems = (localVariable?.queryItems ?? []) + queryItems  

In this case the problem is the overlapping access to an optional, so the easiest solution would be to unwrap urlComponents before mutating its queryItems:

if var urlComponents = URLComponents(url: mutableURLRequest.url!, resolvingAgainstBaseURL: false) {
    urlComponents.queryItems = (urlComponents.queryItems ?? []) + queryItems
    // ...
}

Might not be directly related to the question details, but for anyone googling this error message, be aware that the error also happens on attempt to manipulate with data of ambiguous type (it is unclear if it is class or a struct at the moment of manipulation).

Example when this error might appear:

protocol: AnItemCapableToShowDetails {
    var isShowingDetails: Bool { get set }
}

class: DataItem, AnItemCapableToShowDetails {
   ...
   var isShowingDetails = false
}

class: SomeClass {
   func showDetails() {
       if let dataItem = itemsArray[index] as? AnItemCapableToShowDetails {
           ...
           dataItem.isShowingDetails = !dataItem.isShowingDetails // <- "Overlapping accesses..." error here
                                                                  // because that protocol might 
                                                                  // potentially be applied to a struct as well
       }
   }
}

Possible fix is to make it a class-only protocol, so that compiler is ensured that manipulations are always made with a class.

For before Swift 4:

protocol: AnItemCapableToShowDetails: class {
    var isShowingDetail: Bool { get set }
}

In Swift 4 and later also available (and is a preferred way of doing this):

protocol: AnItemCapableToShowDetails: AnyObject {
    var isShowingDetail: Bool { get set }
}