In general terms, a more recently introduced model is equipped with better internal components (such as a new generation of processors and a faster RAM / internal storage).
You must pay attention to the specifications of the machine and its use case to choose the right one, since it can vary from one person to another and from one task to another. You should base your decision on criteria such as:
Can someone tell me which one is better for Xcode depending on the year?
It depends on your specific use case (and budget) as discussed above. You can compare the detailed specifications of the two mentioned models and base your decision on that. Check the following link:
Also, what is the difference between simple and dual graphics?
A MacBook with dual graphics literally means that it is equipped with a dual graphics card. The one with a single graphics card comes equipped with Intel Integrated Graphics (which is generally speaking good for daily use). Dual Graphics MacBook Pro includes a dedicated graphics card in addition to the Intel Integrated card, and the operating system includes support for automatic switching between the two.
A dual graphics machine is preferred when you need good performance on tasks / projects with intensive graphics, games or a project that needs to use the GPU calculation.