Cannot afford housing costs

I have a friend who is moving out of the marital home. His wife going to stay in the marital home for now, and the plan is to put it on the market next spring. They are both fine with this arrangement.

The problem he faces is that his stbx cannot qualify for the mortgage on her own, and cannot afford the mortgage or the housing costs associated with the home. He is moving to an apartment which would be affordable for her. So in essence, she could pay the apartment rent while he continues to pay the mortgage.

My question is what kind of agreements have you seen in the past that remedied this type of situation? Should he just continue to pay the housing costs while she lives there, while she pays for his apartment? (essentially “trading” expenses)? Or is there something else that would be better from a legal standpoint?

I would suggest that they have an agreement drafted which binds the wife to pay the amount of the mortgage she can afford, and have husband pay the rest. Her contribution to the payment will be the equivalent of what they wish to achieve without complicating the matter by trading expenses.