Reports of machinegun mounted on multicopter out of Ukraine, only time will tell if it would be successful.
---------- Some theory -------------
Swarming is overrated. Micro aerial vehicle is air power with scale falling out of the bottom, and "mass" is just one small feature of air power. Attack is again only a small part of air power as well, and smashing head on into defenses is often inferior to a evasive approach: infiltration and dispersion.
As human scaled aircraft resulted in combined arms joint fighting, micro aerial vehicles will do the same. Most of the ideas about air power could be moved onto modern micro aerial vehicles, but a number of old limitations are removed:
1. Ground based stealth is more difficult than ever. Cover can be bypassed, only perfect top cover works. Cloud cover can be flown under, cost of high performance sensor over time is lower than ever.
2. The bottom has dropped out on addressable targets. Individual infantryman are valid targets. Active defenses are necessary.
When discussing the nature of air attack, one shouldn't forget concepts in SEAD. It is clear to me that there'd be optimal munitions for different target types: high performance munitions (speed, armor, internal countermeasures, etc) to defeat "volume" based defenses (lasers, large number of guns) and low performance high volume munitions against defenses with limited volume engagement capability (large SAM missiles, high performance aircraft AAM).
Some autocannon vehicles are nice, the opponent would bring higher performance munitions to kill that if low performance munitions are inefficient. Against an opponent with full spectrum capabilities, what is needed is to hide and maneuver your various AA assets so the opponent can't tailor a strike package and attack plan to neutralize that. This is a complex problem when the opponent have an array of sensing options and can fight for information as well.
-----------
Overall though, I don't think ground forces can "counter swarm" of sufficient density and sophistication (inclusion of high cost enablers, including SEAD, EW support, etc on top of mission planning). Ground forces lack mobility to mass and still cover the battlespace (for state sized conflicts), and thus suffer from low density, on top of not having initiative. Ground forces can defeat leakers, but I don't think it can defeat air power that can indeed mass.
The anti-swarm options I see happening is airborne lasers and, failing that, air launched micro-munitions. Large air platforms are far faster and efficient for payload/cost, have wide area sensors that all add up to efficient interception capability. A singular large swarm of low performance aircraft can be defeated by a few high performance aircraft with deep magazines and rapid engagement capability. Given a bit of buffer zone, a fast jet can cover far more of the battlespace than ground vehicles. AEW plus F-15s were a far more realistic defense than lining the Saudi boarder with autocannons at 3km intervals (that doesn't even cover high flying threats, can be sniped by ATGM/ballistic missiles/etc), for example, and there is still space to optimize for this mission (eg. remove unnecessary features).
The countermeasure to high performance aircraft by owner of swarms would be to disperse, hide and confuse, exploiting gaps in sensors and command and control. The Japanese Kamikaze did this and had success after large waves got completely smashed by radar directed interception. The ability for dispersed small groups to sneak onto target was also why point defense around the target was necessary despite air superiority.
--------
As for what is going on in the current conflict: defenses don't work all that well, and have limited coverage, there is no need to mass.
It seems to me that sheer platform count are the effectiveness limiting factor here, not defenses (which when effective naturally demand defense penetrating modifications) as civilian vehicles are thrown in at a high rate. A lot of targets can be economically attacked, but isn't because combatants didn't prepare (hundreds of) thousands platforms beforehand.
The thing to think about is about future conflict where equilibrium is reached, where a sufficient mass (relative to marginal cost effectiveness) of drones and other PGM is available on the outbreak of the conflict. Can't expect the next opponent to spend money on ships and new tank development programs and run out of cheap consumables a few month into a war.