You could do something like this:
On your MainController.swift:
func showModal() {
let modalViewController = ModalViewController()
modalViewController.modalPresentationStyle = .OverCurrentContext
presentViewController(modalViewController, animated: true, completion: nil)
}
On your ModalViewController.swift:
class ModalViewController: UIViewController {
override func viewDidLoad() {
view.backgroundColor = UIColor.clearColor()
view.opaque = false
}
}
If you're working with storyboard
Add the Storyboard Dry with the Present Modally
option to your ModalViewController and add the following values:
Background = Clear Color
Drawing = Desactiva the Opaque checkbox
Presentation = Over Current Context
Make sure the segue only uses the DEFAULT
value for the presentation and the transition. Using the current context for presentation causes the mode to turn black instead of remaining transparent.