it depends on how used you are to swimming and . The more of a novice the less it will take to equivalent 4 miles of running. but a total novice that has terrible form just wont be able to get that aerobic benefit in any comparable way
for a swimmer with good technique (that is they can side breathe, do flip turns, and effectively swim for ~1.5k-2k+ yards straight without worrying about not being able to stop then time is a good basis where if you do 100-500 yard reps with 15-30 seconds rest relative to the interval length you should have a 1:1 time ratio from running to swimming for aerobic benefit
I am relatively new to swimming, but I don't think my form is absolutely terrible. I'm sure it isn't great, but not awful.
So, if an easy run of say 4 miles might take about a half hour, then a half hour of swimming once I get somewhat more experienced would be probably "equivalent" to four miles?