Oh God yes.
Historically, Gunslingers were the rough-and-tumble frontier men of the Old West, where, armed with the two most famous guns ever made, the Colt revolver and the Winchester rifle, they fought the natives, the animals, and one another in the name of Humanity Fuck Yeah.
Culturally, the gunslinger was the American equivalent of the European knight-errant, with many an old story of their wandering from place to place righting wrongs and shooting bandits. One famous aspect of these stories is the quick-draw duel, where two men stand in the street at high noon (when everyone knows to get out of the way and the sun is in neither of their eyes), and stare each other down, each waiting for the other to draw first so that he will have the benefit of arguing "self-defense" in court after the duel is over. In most, but not every case, the villain draws first, but the hero is faster than him and kills him.
Just like the medieval knight underwent a series of anti-heroic revisions recently, the cultural myths around the Gunslingers of the Old West have been reexamined in a number of realistic Westerns that paint them in a more morally-ambiguous light.
Because of the usual problem, for years the closest thing the D&D family had to a playable Gunslinger class were the gunfighting Paladins of Murlynd who resembled sheriffs from these Westerns, and whose holy text was basically a pulp novel of his exploits. In 3rd Edition, this amounted to a single feat buried in an issue of Dragon Magazine.
5th Edition first sought to resolve this lengthy injustice by introducing Gunslingers as a sub-class of the Artificer called the Gunsmith. This first version was a quarter-caster, like the Fighter and Rogue spellcasting archetypes, that got a semi-magical "thunder-cannon" that only they could use, and which took an action to fire and a bonus action to reload. While this obviously restricted them to one shot per round, the base shot had the damage-progression of the Rogue's sneak attack, and they learned to fire other shots with various effects (blast, cone, etc.) as they leveled up. They also had the tools needed to recreate their weapon if it was destroyed, and a wonky ammunition bag that didn't technically give them as many bullets as they wanted in theory, but definitely did in practice since they were almost certainly not going to fire more shots than they can produce in a given long rest.
Unfortunately, the Gunsmith and the thunder cannon were removed with the March 2019 Unearthed Arcana, but in its place a new Artificer sub-class (now renamed Artillerist) had the means to create a walking turret buddy by sacrificing spell slots (as well as one free one each day). This turret, while incapable of scaling in damage, could either be a flamethrower, a force-damage ballista, or a healing station. You could also create wands with this subclass, though it was only usable by you and it let you add your Intelligence Modifier to the damage of one cantrip.
The official published version of the Artificer in Eberron: Rising from the Last War kept most of the above Artillerist features, adding the option to make the turret legless, tiny and hand-held (i.e. a GUN). Combined with the ability to fashion arcane focii into firearms, dual-wielding gunslingers had finally arrived in D&D.
Pathfinder actually had the balls to add the Gunslinger as a character class in a world of knights and swords, because fuck medieval stasis; in canon, it's because there's an entire region that's just a massive anti-magic zone so they needed something to defend themselves. They're built on the "Fighter" template, so they get lots of hitpoints and lots of feats, and they enjoy a resource pool called grit that they can use for various effects. Grit is actually regenerated by doing badass deeds of derring-do as much as by rest, so shooting out chandeliers, challenging villains to quick-draw duels, and leaping sideways through the air while firing are all heartily encouraged.
More than perhaps any other class, Gunslingers benefit from Pathfinder's "archetype" system. One Gunslinger class feature basically lets the character pick a gun off a rack to start the game with, since otherwise you'd have to spend more money than the entire party probably has at character creation to buy a single weapon, let alone ammunition; sticking with one type of gun and picking an archetype to go with it is very advantageous. Musket Masters get lots of free reloading powers, Pistoleros get sneak-attack-style extra precision damage, Siege Gunners get to be cannon fighters, etc. Note that there is only one "good" way to do a dual pistol build ("Gun Twirling," which is super feat-heavy), outside of weird stuff (being a member of the four-armed kasatha race, multi-classing to either witch or alchemist long enough to pick up an extra limb, picking the bard archetype for juggling weapons, etc.), so it's tricky to do.
Your firearm is your friend and your bosom buddy. You won't be starting out with a multi-shot firearm for balance, and getting one later is pretty iffy, so making reloading as quick and easy as possible is absolutely paramount. Take the Rapid Reload feat if your archetype doesn't already come with one, and take at least one rank in the Craft: Alchemy skill to make alchemical ammunition at half-cost with no crafting roll. Alchemical ammunition, even when it doesn't have any special powers, further reduces the time necessary to reload a weapon, which is a small price to pay for increased misfires. Getting it down to a free action by the time you can take multiple shots per round is important. Also, when you inevitably roll a critical fumble and your gun breaks, don't be stingy with your grit. Doing a quick clear may cost you time later, but it will save your goddamn life now, whereas having your weapon explode will basically kill you even if you survive it.
They also manage to sidestep most MAD problems, since, although they need more WIS than the average fighter-derivative for grit points, they need less STR if they aren't lugging around an artillery piece. And even then, there's a dirt cheap magic item called Muleback Cords that can easily get around that problem. Plus, one of their strongest powers kicks in at fifth level, where they start adding their Dex to damage with their guns, complete with their own version of Power Attack (Deadly Aim).
Gunslingers aren't really overpowered, since their abilities basically begin and end at pointing guns at bad things to make them dead; they have to stay uncomfortably close for their ranged features to actually matter, misfires are the bane of their existence for most of their careers, and their whole shtick can be shut down in a hurry if the enemy spellcaster summons cover or manages to get their gun wet. That said, they do need to be played against very differently from many other martial classes, so DEFINITELY clear this class with your GM/DM before you roll one. Misfiring is also a perpetual bane until you can afford a +2 equivalent weapon, and if you aren't always prepared for it, you will most likely die.
Most of the listed problems can be easily fixed with cheap wondrous items and weapon enchantments (distance on a musket will double the range to 80 feet), and combat feats like Cluster Shots and Improved Precise Shot remove the problem of DR and Cover. Also, Alchemical Cartridges can't get wet, and even if the GM is smart enough to cast water on your musket (and you lack any Dry Load cartridges), just ask a caster to cast Prestidigitation (lvl 0 spell) on your gun and it will be dry in a standard action. Or, if you're willing to get really pulpy "science-fantasy", try and score yourself some of the technological guns from Numeria; any gun works for a gunslinger, whether it's a blackpowder musket or an ancient alien laser pistol. And for those wanting to go ham on this angle, there's the Techslinger archetype from the Technology Guide.
The issue with this is, of course, that the availability of guns is dependent on setting and feats. In general, a lot of DMs just aren't happy with the changes having gunslingers around would necessitate in their settings, and it is their game, after all. Paizo has ported some of the 'slinger's class features into other class variants in some of their new material, and the "Bolt Ace" archetype basically ports most of their cool stuff into crossbows, so if the mechanics sound interesting to you but the DM is unwilling, take a look. And most people agree that revolvers, rifles, and other "early modern" firearms are a bit too strong, so don't expect to get them at all.
In the end, Gunslingers are tier 5 at lower levels or tier 4 at higher. They can throw out a lot of damage, but at lower levels they struggle to do it consistently. While good at this, base Gunslingers can't do anything else very well, although with some clever skill points, and use of their heavier CHA focus the Mysterious Stranger can take up the place of a Party Face, and the Blast Lock deed can be used to bypass locks (though the subtlety of such a tactic leaves a lot to be desired without oil of silence), so there are some ways to make an "infiltrator" Slinger. They also have a pretty good skill list and a decent number of skill points, so they edge out the fighter in that regard.
Come Heroes of Golarion, any ranged Gish that wants to be is a better Gunslinger than an actual gunslinger thanks to the feat Spell Cartridges. In exchange for a swift action each turn to use Arcane Strike and slightly less damage (1d4 per 5 caster levels) your firearm is semi-automatic, requires no ammo and deals force damage (which is almost never subject to Damage Reduction or Energy Resistance).
|The Classes of Pathfinder|
|Core Classes:|| Barbarian - Bard - Cleric - Druid - Fighter - Monk |
Paladin - Ranger - Rogue - Sorcerer - Wizard
| Alchemist - Antipaladin - Cavalier |
Inquisitor - Oracle - Summoner - Witch
| Arcanist - Bloodrager - Brawler - Hunter - Investigator |
Shaman - Skald - Slayer - Swashbuckler - Warpriest
| Kineticist - Medium - Mesmerist |
Occultist - Psychic - Spiritualist
|Ultimate X:||Gunslinger - Magus - Ninja - Samurai - Shifter - Vigilante|