I am out of touch with the movement towards centralised counterparties, but I assume that the basic principles are similar to when I looked at it.
All derivatives have a risk measure like a daily Value-at-Risk (VaR) associated with them, as well as a net present value (NPV). The fact that it is a swap does not matter; all derivatives will be covered by the same collateral agreement.
The VaR/NPV is calculated using an accepted methodology by both parties. The counter-parties then post accepted collateral in an amount that covers the worst case of the NPV moving against them by the risk measure. (In the case of central clearing, both sides post collateral to the central clearer.) E.g., if the NPV of the counterparty is +\$2 million, but the daily risk is \$10 million, they need to have at least \$8 million in collareral.
This way, if one side fails, the other side can seize collateral to make up for the value of the derivatives position.
In the pre-central clearing days, in the case that a dealer is dealing with an entity that is hedging interest rates, but does not otherwise trade derivatives, the dealer typically sets the terms on how collateral works unilaterally (e.g., the dealer does not post collateral). Banks are in the business of assessing and managing credit risk, so they can handle the credit risks associated with swaps relatively easily. I do not know whether this pattern of behaviour is still allowed under central clearing.