I'm not 100% sure on this one so you'd have to try it and see if it works. nincada doesn't learn swords dance, nor does shedinja by normal methods.. You teach it to ninjask. nincada will evolve at level 20. at level 20, ninjask tries to learn fury cutter, swords dance and protect. teach ninjask swords dance because its movesets are transferred from ninjask to shedinja.. Right after its evolution into a ninjask, it will learn swords dance. allow it to learn it forget another move. then check your party and you will see ninjask and shedinja with sword dance..
This is different to the spore breloom example given below, because nincada doesn't learn swords dance, ninjask does. but if you evolve nincada at the right level, ninjask will learn it, and by a glitch, so will shedinja.. Shedinja should not begin to swords dance until you are confident you know the opponent's team and can predict the opponent's next switch-in. once you are sure all threats are eliminated, swords dance to your heart's delight and watch as your opponent just succumbs to shedinja's silent might.. Well, just like the normal method of getting shedinja from ninjask on level twenty, wait and evolve ninjask on level twenty-five when it can learn swords dance, and then evolve it into shedinja, and you should end up with a shedinja with swords dance! or just give ninjask the tm, and get shedinja earlier than level twenty-five, but above level.