Here are some examples of how the idiom is used:
* "I'll finish this project by tomorrow, when pigs fly!" (Meaning: It's highly unlikely the project will be finished tomorrow.)
* "They'll apologize for their behavior? When pigs fly!" (Meaning: It's impossible that they will apologize.)
The idiom is often used humorously to emphasize the impossibility of something.