Create modal presentation theme

This commit is contained in:
Davide De Rosa 2019-11-19 23:20:22 +01:00
parent 39ff0e3093
commit bacd510345
3 changed files with 9 additions and 3 deletions

View File

@ -142,7 +142,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
wizard.parsingResult = parsingResult
wizard.removesConfigurationOnCancel = true
wizardNav.modalPresentationStyle = .formSheet
wizardNav.applyModalPresentation(.current)
target.present(wizardNav, animated: true, completion: nil)
}
}

View File

@ -110,6 +110,12 @@ extension Theme {
}
}
extension UIViewController {
func applyModalPresentation(_ theme: Theme) {
modalPresentationStyle = theme.modalPresentationStyle
}
}
extension UIView {
func applyPrimaryBackground(_ theme: Theme) {
backgroundColor = theme.palette.primaryBackground

View File

@ -146,7 +146,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
}
pendingShortcut = nil
let vc = INUIAddVoiceShortcutViewController(shortcut: shortcut)
vc.modalPresentationStyle = Theme.current.modalPresentationStyle
vc.applyModalPresentation(.current)
vc.delegate = self
present(vc, animated: true, completion: nil)
}
@ -206,7 +206,7 @@ class ShortcutsViewController: UITableViewController, INUIAddVoiceShortcutViewCo
break
}
let vc = INUIEditVoiceShortcutViewController(voiceShortcut: wrapper.original)
vc.modalPresentationStyle = Theme.current.modalPresentationStyle
vc.applyModalPresentation(.current)
vc.delegate = self
editedIndexPath = indexPath
present(vc, animated: true, completion: nil)