Swap spreads used to be positive because swaps carried bank credit risk. Since clearing and regulation, long-dated spreads in the US have often been negative: holding a cash Treasury consumes dealer balance sheet and repo funding, while a swap does not.
They widen and narrow on flows rather than credit. Heavy Treasury issuance cheapens cash bonds and pushes spreads more negative; large pension receiving pushes them the other way.
Example: the 10-year swap rate is 4.02% and the 10-year Treasury yields 4.18%. The swap spread is -16 bp. Record quarterly-refunding pushes it to -28 bp with no change in outright yields.
Related: interest-rate-swap, ois, repo, quarterly-refunding, treasury-note