IOS-462 cleaner code for handling nav controller
authorDirk Zimmermann <dirk@pep-project.org>
Mon, 08 May 2017 11:28:54 +0200
changeset 213189c3294029e6
parent 2130 ff20df365536
child 2132 4289912d9366
IOS-462 cleaner code for handling nav controller
pEpForiOS/UI/Handshake/HandshakeViewController.swift
     1.1 --- a/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Mon May 08 11:16:16 2017 +0200
     1.2 +++ b/pEpForiOS/UI/Handshake/HandshakeViewController.swift	Mon May 08 11:28:54 2017 +0200
     1.3 @@ -193,14 +193,10 @@
     1.4      override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     1.5          switch segueIdentifier(for: segue) {
     1.6          case .showLanguagesSegue:
     1.7 -            if let navVC = segue.destination as? UINavigationController {
     1.8 -                if let destination = navVC.viewControllers.first as? LanguageListViewController {
     1.9 -                    prepare(destination: destination)
    1.10 -                }
    1.11 -            } else {
    1.12 -                if let destination = segue.destination as? LanguageListViewController {
    1.13 -                    prepare(destination: destination)
    1.14 -                }
    1.15 +            let navVC = segue.destination as? UINavigationController
    1.16 +            if let destination = navVC?.viewControllers.first as? LanguageListViewController ??
    1.17 +                segue.destination as? LanguageListViewController {
    1.18 +                prepare(destination: destination)
    1.19              }
    1.20              break
    1.21          }