Cheapest mac for latest xcode?
The least expensive mac is the Mac mini. It comes without a monitor, keyboard, or mouse so you can use the items from your PC. A new Mac Mini sells for $800. If that is still too pricey you could maybe find a used older mac on Ebay or similar sites. Beware because Macs have a high resale value. So always check the price.
If your needing the latest XCode, be sure that the computer can run Mojave or Catalina operating systems. A computer from 2013 or later should be fine. If you are just learning to code then you can maybe get a cheap laptop or the Mac Mini.
You should check the Apple site to confirm what models can run the latest version of Xcode. My 2013 number was just from memory. The actual compatibility list is given below.
MacBook (Early 2015 or newer)
MacBook Air (Mid 2012 or newer)
MacBook Pro (Mid 2012 or newer)
Mac mini (Late 2012 or newer)
iMac (Late 2012 or newer)
iMac Pro (2017)
Mac Pro (Late 2013, plus mid-2010 and mid-2012 models with recommended Metal-capable GPU)