         else {
             contentMidPoint = headerView.frame.height + (sectionHeight * 0.5)
         }
-        
+
         var topPadding    = max(0, (boundsHeight * 0.5) - contentMidPoint)
         if keyboardHeight > 0 { topPadding += (UIApplication.shared.statusBarFrame.height + 10) }
-        
+
         var bottomPadding:CGFloat = 0.0
         if keyboardHeight > 0 {
             bottomPadding = keyboardHeight + 15
         }
-        
+
         var edgeInsets = tableView.contentInset
         edgeInsets.top = topPadding
         edgeInsets.bottom = bottomPadding

        default: return mailIcon
        }
    }
    
    // MARK: - Login/Register Transition
    
    func setRegistering(_ registering: Bool, animated: Bool) {
        guard _registering != registering else {
            return
        }
        
        _registering = registering
        
        // Insert/Delete the 'confirm password' field
        if _registering {
            tableView.insertRows(at: [IndexPath(row: 3, section: 0)], with: .fade)

    //MARK: - State Management
    private func validateFormItems() {
        var formIsValid = true

        if serverURL == nil || (serverURL?.isEmpty)! {
            formIsValid = false
        }

        if email?.range(of: "@") == nil || email?.range(of: ".") == nil {
            formIsValid = false
        }

        if password == nil || (password?.isEmpty)! {
            formIsValid = false
        }

        if isRegistering && password != confirmPassword {
            formIsValid = false
        }

        footerView.isSubmitButtonEnabled = formIsValid
    }

    //MARK: - Scroll View Delegate
    
    public func scrollViewDidScroll(_ scrollView: UIScrollView) {

        if UIApplication.shared.isStatusBarHidden {
            navigationBar.alpha = 0.0
            return
        }

        let statusBarFrameHeight = UIApplication.shared.statusBarFrame.height
        navigationBar.frame.size.height = statusBarFrameHeight

        // Show the navigation bar when content starts passing under the status bar
        let verticalOffset = scrollView.contentOffset.y

        if verticalOffset >= -statusBarFrameHeight {
            navigationBar.alpha = 1.0
        }
