Added Swift support
Fixed nil view on dismissing presented view controller