icanzilb / SwiftSpinner

A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest
MIT License
2.19k stars 268 forks source link

Swiftspinner doesn't works in more of one view IOS10 #107

Open moiseslugoa opened 7 years ago

moiseslugoa commented 7 years ago

Hello everybody, i get an "error" i used cocoapods for integrate sprinner but only works in my first view for others doesnt do anything like be in freeze, i implement the code in AppDelegate with a observer, and property in SwiftSpiner i change a few features, please help me and i add a snippet of my code

AppDelegate

    func showWaitScreen() {
        DispatchQueue.main.async(execute: {
            self.window?.currentViewController()?.view.endEditing(true);
            UIApplication.shared.isNetworkActivityIndicatorVisible = true;
            SwiftSpinner.sharedInstance.titleLabel.font = FONT_TEX_TITLE_Diezyocho
        if nil == SesionCBHandler.sharedInstance.currentSpinner {
            SwiftSpinner.sharedInstance.removeFromSuperview()
            SesionCBHandler.sharedInstance.currentSpinner = SwiftSpinner.show("T2J0ZW5pZW5kbyBkYXRvcy4uLg==".base64Decoded(),
                animated: true);//"Obteniendo datos..."
        }
        });
    }

    func hideWaitScreen() {
        DispatchQueue.main.async(execute: {
        if nil != SesionCBHandler.sharedInstance.currentSpinner {
            SwiftSpinner.hide();
            SwiftSpinner.sharedInstance.removeFromSuperview()
            SesionCBHandler.sharedInstance.currentSpinner = nil;
        }
            UIApplication.shared.isNetworkActivityIndicatorVisible = false;
        });
    }`

SwiftSpinner

UIView.animate(withDuration: 0.33, delay: 0.0, options: .curveEaseOut, animations: {

                spinner.blurView.contentView.alpha = 0
                  spinner.blurView.effect = nil
                spinner.blurView.effect = nil
                spinner.blurView.contentView.alpha = 0

                }, completion: {_ in
                    spinner.blurView.contentView.alpha = 1
                    spinner.removeFromSuperview()
                    spinner.titleLabel.text = nil
                    spinner.blurView.contentView.alpha = 1.0
                    spinner.removeFromSuperview()
                    spinner.titleLabel.font = spinner.defaultTitleFont
                    spinner.titleLabel.text = nil

                    completion?()
            })

            spinner.animating = false
        })
    }

UIView.animate(withDuration: 0.33, delay: 0.0, options: .curveEaseOut, animations: {

        spinner.blurView.contentView.alpha = 1
                spinner.blurView.effect = spinner.blurEffect

                spinner.blurView.contentView.alpha = 1.0
                spinner.blurView.effect = UIBlurEffect.init(style: UIBlurEffectStyle.dark)

                }, completion: nil)

            #if os(iOS)
                // Orientation change observer
                NotificationCenter.default.addObserver(
                    spinner,
                    selector: #selector(SwiftSpinner.updateFrame),
                    name: NSNotification.Name.UIApplicationDidChangeStatusBarOrientation,
                    object: nil)
            #endif
        }

        spinner.title = title
        spinner.animating = animated

        return spinner
    }
miguelDelgado333 commented 7 years ago

Yes, I have an equal error. Help me friends or I run :(