I hope it's dieing I really do but I think it's just slipping from mainstream rather than truely shuffling off an being dead.
In the UK once you leave the mainstream rap you quickly encounter "Drill" that's just mostly London youth gangs doing Diss Tracs at one another inbetween stabbing each other, selling the shitest weed you'll ever encounter an mugging old ladies for there pension - it has a pecking order of 1st Gen immigrants, 2nd Gen an then everyone else, and if you post public videos of your "Hardware" or some violence your engaged in and bonus points awarded for getting pinched an then let off an how many times.
That's a genera that seems to be growing, the Sub reaches the front page of reddit fairly regularly.
As for "Rap" that you encounter in the mainstream it's getting less popular as the genera is now just worn out, it's had a long steady life in pop culture, but now the crimes the big players are mostly getting arrested for crimes that can't be sold as "Gangsta" an a lot of them are also not from the background they claimed, music execs are realising they have a Hot Potato on there hands an are devesting themselfs from it as fast as they possibly can, this started a few years ago when lots of stories started cropping up of "X artist managed to buy there masters from Y at a massive discount" an started doing re-releases of older songs.
People just don't want it any more, an arguably never really did without a hell of a lot of astroturfing and when that's removed it kinda just goes away or at least shrinks back to it's realistic market size. An with the advent of streaming people are more likely to find music they do like and will chose that, there is also a few other things creeping into it and a lot of it is very indirect but one of the main ones is the increasing association with Criminals an Criminal activity putting more normal people off "Why do I want to listen to this song about a guy smoking bowls, shooting shit up an being a wanker" because they are closer to the millstone of life than these guys, they work a shit job for shit money an shit hours doing a legal job and they have some barely pubescent kid cosplaying a thug living the high life it puts them off so they stop listening because they can't relate to it.
The best music of any era an any genera is stuff that resonates with people or inspires them, and Rap is no longer that - we're in a post aspiration / fantasy age and have gone back to the world being more directly experianced and people want media that reflects that so - Rap, Capeshit films, Romance, manufactured dreams are selling less and the markets adjusting to that, after society started that shit 5 - 6 years ago.