If WiFi Assist is on, it's using a combination of cellular data and WiFi to make connections to the internet. This may be preventing the Desktop App (on MAC) from recognizing the iOS device over WiFi.
To turn off WiFi Assist on an iPhone or iPad, please follow the path below:
Step-1: Go to Settings > Cellular or Mobile Data.
Step-2: Scroll down and tap the slider for WiFi Assist to turn it off.