It's pretty simple. Iran could have produced a nuke at any point in the last decade but they didn't. Because they didn't want one. It frankly wasn't in there best interests to attempt to produce a nuke. Had they been trying, the UN, not just the US, England or Israel, would have done something about it. There would have been no "Coalition of the Willing". Iran, though not our friend, isn't a wild, out of control Jihadi nation of some sort. They understand what they're up against. They aren't going to poke the bear, especially with very little to gain.
Now, in rolls Obama. There has not been a President in history more concerned with his image or his "legacy" than Obama has. He can't stop talking about it now that he's gone. His legacy was more important to him than anything. He wanted to be able to say he'd gotten some sort of deal done with Iran, to have that little check mark next to his name. So he made a deal that freed up millions and millions of dollars of their money and helped Hezbollah go from a regional terrorist organization to a world wide arms/drug dealer to do it.