iMac longevity for iOS development My budget is low, so I want to buy a used iMac for learning and developing iOS apps. I am wondering which year model I should buy because the older the cheaper. 

So, my question is:
How can I evaluate how long an  iMac or (any Mac for that matter) can be supported for iOS development?. 

Is there a written support policy and/or how has things been handled in the past so we can attempt to "forecast" today?
...Because the older the cheaper


This goes without saying!


  How long a 2012 iMac can be used for iOS development? Or in more general sense, how long an iMac can be used for iOS development?


Nobody can really answer this because nobody can know for sure when any particular model Mac will no longer be supported.  In fact, this article goes into detail, but their very first words are "Apple has no written policy"

IMO, the 2012 is probably not the best choice because it's at the "cutoff" for supported iMacs on the macOS Catalina release.  

Will it...


be supported by the next version?  Nobody knows.  
still receive updates?  Most likely.
run the version of XCode required to develop on the latest iDevices?  That's the kicker.  It may or may not.


Being that your at the very end of the line, I'd look for something about 3 years "younger."  This will buy you some time before you get a more modern, well supported machine.