This can help
let url = ..... // your url
var warehouseOrders = .... // your array
private var cancelable: AnyCancellable?
private static let sessionProcessingQueue = DispatchQueue(label: "SessionProcessingQueue")
private func loadWarehouseOrders() {
cancelable = URLSession.shared.dataTaskPublisher(for: url)
.subscribe(on: Self.sessionProcessingQueue)
.map({
print("\n $0.data: \($0.data)")
return $0.data
})
.decode(type: WarehouseOrder.self, decoder: JSONDecoder())		// if you have a WarehouseOrder model
.receive(on: DispatchQueue.main) // <-	 here is the problem, you are missing this
.sink(receiveCompletion: { (suscriberCompletion) in
switch suscriberCompletion {
case .finished:
		 // do something that you want to do when finished
break
case .failure(let error):
print(error.localizedDescription)
}
}, receiveValue: { [weak self] (warehouseOrder) in
self?.warehouseOrders.append(warehouseOrder)
})
}
deinit {
self.cancel()
}
func cancel(){
cancelable.cancel()
}