Calvin Harris and Rihanna’s recent smash hit ‘This is What You Came For’ may have had an unlikely co-writer, the DJ’s ex-girlfriend Taylor Swift. The idea that Swift shares writing credits on the track started as a fan rumour, but now TMZ claims it’s true and may have even led to their break-up.

A photo posted by Taylor Swift (@taylorswift) on

According to TMZ, while they were dating Swift wrote the song on a piano and recorded a demo on her iPhone. She then sent it to Harris who loved it and they went into a studio and did a full demo with Swift on vocals and Harris providing the beat.

But the couple then both agreed not to let everyone know it was a collaboration, as they thought it would overshadow the song. So Swift kept the publishing rights and used the pseudonym, Nils Sjoberg on the credits.

More: Taylor Swift Pays Surprise Visit To Children's Hospital In Australia

Swift was said to be fine with Harris recording and releasing the song with Rihanna, but things then got messy when the DJ was asked if he’d ever collaborate with his girlfriend. Appearing on Ryan Seacrest's radio show the day the song was released, Harris was asked if a collaboration with Swift was likely.

Harris answered: "You know we haven't even spoken about it. I can't see it happening though.” According to TMZ, Swift was hurt by his comments and felt he took it too far. A source called it "the breaking point in the relationship.”

More: Taylor Swift Is The Highest-earning Celebrity Of 2016

Several days later Swift was photographed dancing with Tom Hiddleston at the Met Gala, who she would go on to date after ending her relationship with Harris. Swift has the right to stop Harris from performing the song, but she hasn't and doesn't plan to ever exercise that right.

If true it’s not the first time a collaboration between Harris and a girlfriend has turned sour. While he was dating Rita Ora he penned and produced her song ‘I Will Never Let You Down’, but following their break-up he has reportedly banned her from performing the song live.