People don't like the word but you basically had asthma temporarily. Real asthma appears on a regular basis with certain stimuli. But, just about anyone can have the same set of symptoms when they get a bug (virus or bacteria) that sets it off. Often it's just a virus but physicians with poor judgement or pressure from patients prescribe antibiotics. Often people get an Albuterol inhaler, which if it is effective for you is fine and will help.
A way to visualize this 'attack' is to think of your lung being 'sprained' by the illness. You have swelling, narrowing of the airways (bronchoconstriction), and increase in mucus productions, with a thickening of the usually thin mucus. Essentially it's inflamed. The lung only has one way to tell you it's unhappy since it does not have pain receptors > cough. Sometimes that cough is pretty damn bad. Antibiotics will do nothing to deal with a virus. Albuterol will relieve the bronchoconstriction if you have it but only for ~ 4-6 hours. The most effective medication for this is an inhaled steroid to deal with the underlying swelling, the same medication that is the cornerstone of good asthma treatment. Unfortunately unless you are a 'real' asthmatic the physicians almost never prescribe this for a 'normal' person having this problem.
Just like a sprained ankle can take several weeks to get over fully, a 'sprained lung' can be the same. Depends a LOT on HOW sprained, and what treatment. Inhaled steroids can shorten this dramatically by reducing the inflammation.
If you are crackling, and coughing productively your aren't ready for the water yet. You are past the worst part of the sprain, but you aren't fully healed yet. Sounds like you'll likely actually know when you are ready, you just aren't ready to hear it.
(Note - I'm not saying antibiotics is the wrong thing to do. It is the right thing IF you have a bacterial pneumonia. VERY often people do NOT, and get the antibiotics anyway. This is just one more step that is pushing us all toward organisms that are resistant to all antibiotics. When we reach that state the entire world is going to be in serious trouble)