prior swift 3 i was adding shadow in my UIView like this :
//toolbar is an UIToolbar (UIView) toolbar.layer.masksToBounds = false toolbar.layer.shadowOffset
After spent lot of hours, I just find out the solution, just add this simple line.
backgroundColor = .white
Hope this help you!