Robert A. Heinlein's Glory Road features an adventure through multiple parallel universes having different laws of physics that prevent firearms from working, forcing the protagonists to rely on swords, bows, and sufficiently advanced mathematics (aka Magic).
In The Wheel of Time, black powder exists but is used solely by the Guild of Illuminators for fireworks, which are sold at astronomical prices with many dire (and often sensationally untrue) warnings against ever trying to open them. Mat Cauthon uses fireworks tactically a few times, then jury-rigs them into bombs in Knife of Dreams, and finally partners with a rogue Illuminator and the Crown of Andor to manufacture the first cannons, which are used to devastating effect in the Last Battle.
The series proves a good fantasy world can work with guns. Just replace Knight in Shining Armor in military aristocracy with The Gunslinger and keep a straight face. Then again, The Dark Tower isn't your run-of-the-mill fantasy.
It's actually more or less stated that the gunslingers are direct descendants of not just your standard fantasy knight equivalents, but All-World's equivalent of King Arthur and his Knights of the Round Table. The metal in Roland's guns is supposedly from Arthur Eld's melted-down sword. That makes it easy to "keep a straight face."
Also All-World, Roland world, was once a futuristic world not that different from ours, but there was some type of apocalyptic war went down and now it's "After the End" besides other guns do show up from time it's just not many are left any more, and of those not many work (thought some new ones do come in from other levels of tower from time to time.) Guns are rare simply because no one knows how to make or fix anything complex. The world has moved on.
Averted in another, related, Stephen King novel, The Eyes of the Dragon. The mediaeval-style kingdom of Delain has gunpowder and cannon, though they are high-tech enough to be rare, but King Roland killed the eponymous dragon with a bow and arrow, which was was a key point in the climax of the book.
A science fiction version of this in the early Gor series books. The author (John Norman) wanted the characters using primitive weapons only, so he had the alien Priest-Kings prohibit the inhabitants of the planet Gor from possessing firearms. Anyone who violated the rule suffered the "Flame Death" (inflicted Spontaneous Combustion). In a later book, their enemies, the Kurii, "got around this" by giving their human collaborators powerful air rifles. In real history, such weapons were used by Austrian troops in the Napoleonic Wars, and Lewis & Clark took one on their expedition across North America. The major advantage in the Kurii's case was that the air rifles had greater range and accuracy than the common bows and crossbows the Priest Kings permitted, but unlike gunpowder weapons were nearly silent. Which actually was the main reason the Austrians and Lewis & Clark used them- the early 19th Century version of a suppressed weapon.
There's an aversion in the first of the Kai Lung series of stories, where a bandit is shown armed with a handgun as a way of calling attention to the stories being about an extremely fictionalized Ancient China.
In Joel Rosenberg's Guardians of the Flame series, the heroes, who are all modern-day college students, introduce gunpowder technology to the fantasy world they've been teleported to. This prompts the natives to develop a Magitek version involving superheated steam and a spell that prevents it from expanding until the proper conditions are introduced by the pull of a trigger.
In Diana Wynne Jones's Dalemark Quartet, guns exist, but they're rare and expensive because few craftsmen have the skill to make them (the state of the art is roughly equivalent to our 18th century). South Dalemark armour is specifically designed with "exaggerated curves" to deflect bullets.
Guns do work and some people know how to make them, but they're considered impractical because chaos mages can cause gunpowder to ignite from a distance, killing the would-be gunslinger. This is subverted both early on and late in the timeline. The "angels" from another universe in Fall of Angels possess slug-throwers, rifles, and lasers, but those run out of ammo, energy, or break. In the later books, Hamor perfects a manufacturing process that allows bullets and cannon shell to be virtually immune to chaos magic. Other modern weapons make their appearance: anti-personnel mines, rocket guns, and even Frickin' Laser Beams on a Kill Sat when sunlight focused by a lens (and Order) carried on a hot air balloon destroys Fairhaven
The Corean Chronicles, on the other hand, did feature firearms. The prequel trilogy stated that the Cursors tried to ban all rifles used by their subjects other than one standardized caliber - which didn't have the stopping power needed to hurt a Cursor unless the shooter was very lucky. This was to prevent the lower classes from developing large caliber rifles, and any kind of cannon, so that they couldn't make a serious effort at rebelling. This effort fell apart shortly before their empire did (for totally unrelated reasons).
In the Coldfire Trilogy, guns exist but generally are not used, as the psychological impact of the fae (which alters the real world based on the subconscious thoughts and fears of people — sort of, see its page for a better explanation) mean they have a nasty habit of not working properly, they're rarely used in combat.
The Monarchies of God pentalogy avoids this one, with primitive guns and swords coexisting seamlessly. The guns are only able to be fired twice a minute (three times if the soldier is particularly well trained) and have a limited range, so arrows of various sorts are still useful, and traditional cavalry and infantry are the bulk of forces.
The series does not have guns, but it does have dynamite-like munitions. These are quite nasty: In Reaper's Gale, a few Malazan soldiers armed with munitions manage to fight off and seriously injure several dragons, including Silchas Ruin, a BadassAscendant.
These munitions are still tightly controlled since only the Morath warrior clans are able to manufacture them on a large scale and are picky on who they trade them to. When a Malazan army recruits an alchemist to make their own versions, the final products are very effective but are essentially biological and chemical weapons rather than pure explosives.
The Morath also keep the most powerful versions for their own use. While the standard munitions are extremely lethal, when an army's sappers get their hands on some stolen advanced munitions, they end up blowing an opposing army to smithereens in the opening action of a battle with a single salvo. It's no wonder that the Morath keep such tight control over these weapons.
In Roger Zelazny's The Chronicles of Amber series, gunpowder just doesn't work in Amber because the laws of physics are different there. And then subverted in The Guns of Avalon, when Corwin discovers a substance in a nearby Shadow world that can combust in Amber — and immediately brings mass quantities of the powder to Earth and has it made into ammunition, arming his troops with modern automatic weapons. As it happens, the stuff doesn't combust on Earth (or on its native plane, where it's used as a gem polishing compound), so he gets some weird looks from the munitioners he commissions to make his ammo.
Played with in one of the books. It is revealed in Orca that, long ago, soldiers used weapons along the lines of magical flintlocks — they look like sticks, are one-shot, and are just as likely to amputate the fingers of the user as kill the enemy. Later, at the time of the Khaavren series, "flashstones" are used, which are sort of like a combination grenade/gun; they only allow two shots at best, and blow anyone hit by them to pieces. Thanks to advances in Magitek, though, by the time of the Taltos series, there is no need for anything like this, as you can simply draw on the Orb's power to attack an enemy.
In a book set later in the series' timeline it's mentioned that flashstones were discontinued after a sorcerer developed a counterspell that could remote detonate an opponent's stone (usually with fatal consequences for the opponent). This counterspell was area effect, and in its first public casting was applied to the entire opposing side at once. Ouch.
The absence of guns is probably more a case of Brust's personal fondness for swashbuckling over shoot-em-ups. Note that it's not just firearms that are excluded; even archery is apparently not much practiced in the Dragaeran Empire, as Vlad doesn't even recognize that the bows ("javelin-throwers") wielded against his unit in Dragon are weapons until they're explained to him. The fact nobody can believe Vlad could bag wild game without sorcery suggests that arrows aren't used in hunting either.
Averted in Barbara Hambly's The Windrose Chronicles. Handguns are not uncommon, and anyone expecting to go up against wizards with one has magic-nullifying runes carved on theirs, so it doesn't end up exploding in their hand.
Guns exist in the Muggle world; for example, the Muggle news claims escaped criminal Sirius is carrying one (he really has a wand, of course). While the Ministry of Magic has a department to study Muggle artifacts, no wizard (or even squib) is ever seen using or even carrying a gun. This may have something to do with it's being set in 1990s Britain, where guns are far from commonplace even amongst Muggles.
And, indeed, wizards don't even appear to know what guns are, in spite of the many wars that one must assume they noticed. The Daily Prophet has to explain them as "a kind of metal wand that muggles use to kill each other." Kingsley Shacklebolt also makes a comment to Arthur Weasley, incorrectly referring to them as "firelegs" instead of "firearms," implying that they're completely off the ordinary wizards' radar.
The Death Eaters despise Muggles, it therefore follows they'd not consider Muggle technology remotely worth using. The "good guy" wizards, though they do kill, aren't seen using Avada Kedavra; combined with the lack of interest in Muggle technology among most wizards in general it figures they wouldn't be interested in firearms.
Word of God is that the magical higher-ups do understand guns and other Muggle weapons, the Masquerade is in place because of it. Even though "A Muggle with a shotgun will usually beat a wizard with a wand" wasn't actually said by Rowling, it's still probably true. The supplementary material makes it clear that if it ever came to open war the magical world wouldn't stand a chance, partly because it came very very close in the past.
Subverted heavily in Everworld. 5 modern teenagers find themselves in an Alternate Universe full of ancient gods and medieval technology. There are several references throughout the books to situations where artillery or handguns would be very useful.At one point, they trade a modern chemistry textbook to the Coo-Hatch in exchange for attaching their metal that can cut through anything to one of the main characters swiss army knife. The Coo-Hatch use the technology to build a primitive cannon, which is used at the battle of Mount Olympus. And of course, later in the series, Senna uses her powers to bring in a small, heavily-armed group of followers from our universe, and they conquer several cities and kill a minor god, thus threatening all of Everworld.
Garth Nix's Old Kingdom trilogy features a dichotomy between the magical Old Kingdom and the modern (early 20th century) world, Ancelstierre, separated by a wall. The closer one gets to the wall, the more modern technology falls apart — machine-made paper crumbles, and firearms stop working. However, the border guards use guns to blow away zombie baddies who try to cross into the modern world from the Old Kingdom. Provided the wind doesn't blow from the north. Apparently whatever anti-technology aura the Old Kingdom possesses is blown around by the wind. The guards also carry magic swords as backup (unofficially), and some are even mages. Not just guns are controlled: anything using post industrial-revolution tech falls apart. This includes machine-made paper, and the flammable chemicals in gunpowder become inert. The inverse is also true, magic doesn't work much past the wall.
David Weber's Bahzell series doesn't have guns, until a short novella has Wencit use magic to summon help from beyond. Bringing a pair of US Army troops in a Stryker gives people who see it ideas. And averted in his Safehold series where culturally the whole planet is in stasis, but cannons of varying sizes are commonplace, and then the spirit of a long dead Interstellar naval officer arrives in a cyborg body and teaches them about rifling.
A Song of Ice and Fire has no guns, although the Westerosi do seem to have invented a kind of ersatz Greek Fire in the form of wildfire. Something suspiciously similar to gunpowder is used by Far Eastern entertainers for fireworks and fire shows. Melisandre carries a small amount of the stuff for spicing up R'hllorian rituals, but is, most likely, unaware of the powder's potential military usefulness.
In Robert Lynn Asprin's Myth Adventures series has dimension-hopping, high technology, and plenty of warfare, but no guns. The stereotypical mobsters carry crossbows in their violin cases, and others use magical wands. There are references to firearms, but for "demons" it's not a best option: in a random dimension one clearly has better chances to get either crude bolts or Ley Line than ammo for the specific gun.
Averted in the Heirs of Alexandria books by Mercedes Lackey, Eric Flint, and others. They're set in an alternate 1500s, and guns are certainly present, and about as effective as they were in our 1500s.
David Drake and Eric Flint avert it again in their Belisarius series, where the eponymous general knows of guns and actively tries to arm his troops with them. But attempts to produce them en masse when your industrial base is basically just a bunch of haughty Byzantine artisans (who do not know and do not want to know anything about, say, standardization) usually give interesting results. Pistols and rifles yes but both sides use cannon, rockets and grenades aplenty.
Averted in Death of the Necromancer by Martha Wells. Guns exist side-by-side with knights, swordplay, and magic (including that of the eponymous necromancer). The prequel, "The Element of Fire," has a quasi-Elizabethan setting, and the protagonist uses a wheel-lock gun in the first chapter.
Averted in the Mistborn series, as you find out in the third book that gunpowder does exist, but the Lord Ruler suppressed knowledge of it, since it could allow for the creation of large rebellious armies that needed little-to-no training.
It is then averted in the Alloy of Law, which is a fantasy equivalent of the wild west: aluminum guns and bullets that can't be affected by magic, speciality guns with entirely internal triggers and safeties that can only work for certain types of mistings, new combat counters for mistings that have arisen in the gun age, and even speciality anti-misting bullets that exploit those anti-gun counters.
Averted in "Sixth Of The Dusk" as well, the protagonist is from a culture roughly equivalent to Polynesia post European contact: a stone age culture that's starting to assimilate technology from somewhere in the 1800s. He himself doesn't use guns, but they do. They're enough to kill the theoretically unkillable Nightmaws and drive off the Shadows Beneath from a ship.
Averted in The Last Unicorn where guns are mentioned though not used. The book itself is a bit of of an Anachronism Stew, because John Henry is mentioned as well.
Literal Fantasy Gun Control is in Lord Kalvan of Otherwhen by H. Beam Piper. The priests of Styphon control the knowledge and production of "fireseed" (aka, gunpowder) to their political and economic advantage: supply fireseed to one side in a war and not the other, and the war is effectively over, so they have exercise something between extreme influence and out-right control of the entire world. Unfortunately for them, Calvin Morrison accidentally hitch-hikes from our world to theirs due to a ParaTime accident, and has full knowledge of the formula and method of production of a more powerful form than Styphon's House.
In the alternate Earth of The Case of the Toxic Spell Dump, mundane firearms (called "mechanicals", to distinguish them from wands) do exist, but in a far more primitive state. It's explained that wild elemental spirits are evidently attracted to explosives, and would cause the weapon to blow up if a gun used powder of greater than medieval-era purity.
Averted in various "fantasy-of-manners" series, which include firearms as a natural part of their post-Renaissance motif.
Averted in Artamon's Tears by Sarah Ash, where gun are used quite liberally by the people of Tielen, which allows then to conquer the rest of the world, which does have Fantasy Gun Control.
Downplayed in the Queen's Thief series. While the countries in the series are Fantasy Counterpart Culture versions of Ancient Greece and Persia, the setting has some late Medieval elements, including flintlock weapons. Eugenides notes in The Thief that they're primitive and considerably less accurate than crossbows. They are also heavily controlled by mundane law: Attolia has some handguns on hand for use by the Royal Guard, but no one has an assigned handgun. When the situation calls for a gun, the soldiers report to the armory and collect the weapon, then turn it in when they go off duty.
Averted, and then re-established in the book Men at Arms. A gun is invented in Ankh-Morpork, and it takes control of whoever wields it and turns them into unstoppable killers. When the arcane thing is finally defeated, it is buried forever with a fallen guardsman so he can have a peerless weapon in the afterlife.
That said, they do have black powder, cannons, what have you. The issue appears to be mainly that when they're as portable as the "gonne", the amount of magic in the air even in mundane parts of the Disc makes the little voice in your head telling you how powerful this tiny killing machine makes you move into the weapon itself.
The "gonne" itself practices Fantasy Gun Control as it insists that no copies should be made and kills an artisan who tries to duplicate it.
Note that only the Agatean Empire has cannons, and it has little contact with the other Discworld countries. Also, its cannons are still on an early stage, exploding as often as not (although one Agatean character speculates this is more due to the excessive ornamentation and lack of real quality control than anything).
In the Liavek books, guns exist, but it's possible to use magic to keep them from working within an enclosed space.
A gun is one of the undead magician Skulduggery Pleasant's favourite weapons. It's an old-fashioned revolver, matching his sense of style. An old Necromancer adept uses a flintlock in one book, and in a memorable scene in Dark Days where a group of assorted supernatural villains pull machine-guns rather than magic on the heroes. The books still have some fantasy gun control... it seems some sorcerers consider them crude.
Guns and explosives exist in the universe of the Soldier Son trilogy. In this universe, iron kills magic, making the Gernians' guns a very effective weapon against the plainsman mages.
Last Dragon has the soldiers of Proliux using arquebuses in their conquest of the north.
In John Ringo's Council Wars series, Mother, the AI that runs Earth, actively suppresses energy releases over a certain low threshold (except in very specified circumstances). Before the war breaks out this was just a matter of public safety, and no one really cared because their Clarkes Law tech rendered such limits irrelevant. Following the outbreak of war, and the resulting loss of the supertech to most of the population, it means that not only can they not use firearms, they can't use most forms of internal combustion engines or power production either.
Averted in Septimus Heap, where a gun made out of silver plays a major role in the first and third book.
In the first two books of Arcia Chronicles, guns and gunpowder raise no eyebrows (even though they are still too expensive for everyone but the nobles), but after the Time Skip, The Church finds a magic to remotely detonate all gunpowder in the vicinity, putting this trope into full effect.
Guns aren't specifically mentioned in Pamela Dean's Secret Country books, but high tech items you bring from the earth dimension tend to turn into their medieval equivalents in the Secret Country, e.g. a flashlight becomes a lantern, and a digital watch becomes its 15th century equivalent. One presumes that if you brought a gun it'd turn into, say, a bow & arrows.
Averted in the Lord Darcy stories by Randall Garrett. Though the world is very much a 'magic is the science' environment, guns are known and commonly used. Clearly seen in ''The Eyes Have It''.
Averted in Tales of the Branion Realm only in that naval ships are mentioned to have cannon, in two books set 250 years apart — you'd think that the technology would have percolated onto land by that point, but it hasn't. On the other hand, Seer Archers with the prophetic ability to See where their arrows will land are more accurate than any gun of the period could possibly be.
Obliquely mentioned in The Lord of the Rings. Saruman's army uses blasting powder to breach the wall at Helm's Deep. Later, there is a blink-and-you'll-miss-it mention of Sauron's forces blasting breaches in the Rammas Echor. In The Hobbit, Orcs and Goblins are said to delight in explosions and other such mechanisms. Going back several thousand years, Tolkien's early drafts of the tale of the Fall of Gondolin feature Morgoth's forces using what amount to APCs, but he removed these in later writings.
Averted and Lampshaded in Rune Breaker , Ere. Two characters use rifles and an ancient wizard complains bitterly about guns and grenades in the hands of non-wizards.
The Chathrand Voyages is a high-seas fantasy epic that quite thoroughly averts this one; all naval ships seen in the books (including the eponymous Chathrand) carry a full complement of cannon as their primary weapons regardless of national origin. Personal firearms exist but are still largely unknown; Sandor Ott, consumate Magnificent Bastard and Badass Grandpa that he is, has managed to get his hands on a pistol, however, and makes plain his belief that they'll be in common use in a century or so.
In V. Zykov's Way Home series of novels, gunpowder has been invented long ago. The invention was forgotten as an Area of Effect gunpowder-exploding spell was developed, rendering all firearms (personal to vehicular) moot. Averted later as the protagonists encounter unidentified ships carrying cannons and a ship-ranged counterspell, preventing mages from both detonating the ammo chamber and from destroying loaded cannons.
In V. Zykov's War for Survival series of novels, a whole city is transposed into a Magical Land. The humans liberally use firearms from the city's police and army compounds to wage war both against the world's inhabitants and in the city. As firearms are either underpowered or downright useless against some opponents, the city dwellers begin to resort to the arcane and divine magic which has awakened in some of them.
Averted in the Non Compos Mentis series of novels by Yuriy Ivanovich:
Flor is an explosive compound placed similarly to plastic explosives and triggered by any incendiary spell.
Dragons use solid fuel pills to enhance their fire-breathing ability by chewing the pills and mixing the resulting powder with their naturally flammable saliva into an equivalent of napalm. The pills themselves make for a sufficiently powerful explosive, used e.g. to take out a warehouse by exploding the fuel pill crates.
Among surviving ancient Precursor artifacts the most numerous would be the "litanra". Similar to a crossbow in appearance, every litanra uses a clip housing small energy balls for ammo, and features single-shot and burst fire modes. Another artifact recharges empty clips within minutes, apparently using ambient background magic. Litanra charges explode on hit and pass magic shields. Without a litanra, charges can be simply ejected from the clip, flung around with telekinesis spells and triggered by incendiary spells.
Litanra charges are especially nasty due to both the unexplained principle of burst shots being exponentially more powerful than single shots and the invention of a spell to reflect litanra shots while discharging them as hurrican supercells.
The Precursors have installed upscaled stationary litanras on a strategic location to allow long-range bombardment of almost the entire continent.
Yuriy Ivanovich's Father of Emperors:
Gunpowder works in the Magical Land the protagonists find themselves in, and they find historical evidence of firearms invented and then forgotten.
Centuries ago, a level 20 mage had approached a cannon-armed castle in the guise of a fleeting peasant and had cast the "solid air" spell inside the cannon barrels right before the besiegers entered cannon range. Attempts to fire the cannons caused critical failures, the castle was conquered and razed.
The protagonists loose a ship to the same tactic. Later they sink the hostile mages' vessel by ordering one allied mage to protect one cannon from being tampered with during the battle.
Another human from Earth made a career as a backwater Sanier kingdom's chancellor and introduced, among other things, artillery and riflemen companies to the army. The Sanier kingdom proceeds to curb-stomp the neighbors' armies and to cut bloody swaths into knight armies until the protagonists intervene.
An army detachment from Sanier is attacked by a "stone anaconda" guardian golem. As the golem ravages the infantry, the artillery opens fire on it regardless of "friendly fire".
Level 44 mages can cast a gunpowder detonation spell at about 50 meters, level 71 mages at about 5 kilometers of range. A mage at a level above 71 breaks the siege of the Vaderlon city and curb-stomps the above-mentioned Sanierian artillery and riflemen, complete with exploding ammo carts and infantry reduced to bloody bits.
Averted in the Polish fantasy novel Achaja where the invention and spread of rifles leads outright to an End of an Age. Such a revolution in the art of war creates a world where a mere peasant familiar with the basics of shooting can put the Master Swordsman down with no sweat.
In The Darksword Trilogy, Magic is Life, while Technology is Death. E.g., a mage shapes a wooden chair from living wood, while technology kills the tree to make the chair. The Magocracy strictly enforces this rule, so the few rebel technologists hide in remote areas, their technology mostly stuck in the Dark Ages.
In Robin McKinley's The Blue Sword, the local magic, called kelar, can cause firearms to jam or explode en masse, which was a big part of how the desert nomads known as the Damarians held the modern Homelanders at bay. Also seen in the story, when a group of Homeland soldiers leave their guns behind when marching out to fight with the Damarians against a mutual enemy.
Zigzagged. Guns do exist and can be made quite easily. The problem is, these guns have been invented by the minoi, or "tinker gnomes", whose racial hat is Bungling Inventor. As a consequence, even beyond the fact that they are a peaceful people who have little inherent use for weapons in the first place, their guns tend to be ridiculously overcomplicated, heavy, inaccurate and prone to exploding. Furthermore, they can't sell these weapons to any other race (since "Gnomish invention" is interchangeable with "dangerous and unreliable piece of junk"), and no other race is inclined to develop them, since science in general has become regarded as the province of fools, imbeciles and lunatics, thanks to the minoi.
In one Dragonlance short story (Jeff Grubb's "Boom"), an unusually bright gnome actually discovers atomic fission weaponry. The leaders of the gnome immediately take his notes, lock them away, and exile him. He then turns to the dragonarmies of Takhisis; the wing commander refuses to countenance the idea of such a weapon (partly because it is far too impractical to use, mostly because the weapon is far too horrifically destructive) and sends him into slavery, covering up the weapon's existence forever.
PlayedWith in The Children Of Man. Firearms are a recent invention in this world, and Merchant House Evensong has a monopoly on their manufacture. This makes securing Evensong's loyalties a major priority for both sides in the upcoming war.
The Night Land: Despite being set thousands of years in the future, humans don't use firearms, only the Diskos—a circular, spinning sawblade on a stick. The basic explanation is that knowledge of the workings of still-extant ranged weapons was lost ages ago; besides, the humans' philosophy is that if a monster is too far to be struck with a melee weapon, then it's better to avoid it rather than provoke it into attacking. The narrator also suggests that, perhaps, the laws of chemistry don't work the same way in the future. Overall, using ranged weapons is considered a waste of the limited "Earth-Current" energy on which most future human technology runs.
Damsels Of Distress: The world that the stories take place in take influence from westerns and mob stories. Guns are commonplace with the titular Damsels being in possession of a load of firearms. Most of the pistols are revolvers and there are lever-action and bolt-action rifles. There is also a heavy machine gun, which is one of the more recent developments in weapons technolgoy.
Journey to Chaos: This is a case of Playing with a Trope. In the magic world of Tariatla, gun use is absent despite it being an otherwise modern 21st century world. Basilard states this is because guns are Awesome, yet Impractical. It's a lot of noise to no effect and in the time it takes to build one, he could train a dozen people to use Hand Blasts, which would be more effective but less costly (soldier wages=ammo expenses). The one place in the entire world where guns are as lethal as they are in real life is Ceiha, which lacks mana and is therefore lacking most fantasty tropes.
Averted in Weavers of Saramyr, rifles are common and the main weapon of the stories. Practically everyone knows how to use a gun, even women of nobility are trained in its use at an early age. It reaches a point where swords only see play in desperation battles against Aberrant beasts and heavy casualties for their users are to be expected.
Thoroughly averted in The Powder Mage Trilogy. The action takes place in a time frame roughly equivalent to 18th century Europe which means that firearms are commonplace and wars are waged with cannons, artillery and muskets. Not only that, but the Powder Mages themselves require actual gunpowder to work their sorcery, which mostly revolves around Improbable Aiming Skills, as well as telekinetically manipulating and redirecting the force of exploding gunpowder.
In the Black Blade series, guns are acknowledged to exist, but are strictly outlawed in Cloudburst Falls. This is because they disturb the tourists - a Family enforcer in a suit with a gun looks intimidating, while that same enforcer in a Renfaire outfit carrying a sword is part of the scenery. The mob families all respect and obey this law, though this doesn't cut down on violent crime in the slightest.
In The Pillars of Reality, while a lot of the population don't have much more than medieval technology, the Guild of Mechanics has rifles and pistols. The various governments of the world can pay exorbitant fees for a small number of guns, but the Guild ruthlessly suppresses anyone's attempts to make their own.
The Shannara series by Terry Brooks plays this straight for a while, with no firearms in the first twelve novels. Beginning with Tanequil, the series averts the trope by skipping directly from swords and longbows to ray guns. (The Genesis of Shannara prequels are another matter; they take place during the late 21st century in the U.S., and have everything from gun-equipped sport utility vehicles to nuclear weapons.)
Averted in A Fox's Tale: The Warden's Daughter, set in a Fantasy Counterpart Culture very similar to the Holy Roman Empire. Muskets exist right alongside magic, and have the same effectiveness as actual ones.
In Tales of the Otori, firearms are rare curios brought to the Three Countries by Western traders. Takeo sees their devastating potential and, upon gaining power, outlaws their import and takes pains to ensure that nobody outside his regime gets access to them. This becomes a source of conflict in the sequel The Harsh Cry of the Heron when a general of the greater Empire wants in on the secret.