Dark shadow on navigation bar during segue transition

I ran into a minor problem: during segue transition a dark shadow appeared for about a second on navigaition bar. It was not a fatal problem but really annoying. I fount solution here, it is for objective-c and for xcode5, but generally it still works:


For swift3 the code is the following: