{"action":"created","issue":{"url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/214","repository_url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView","labels_url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/214/labels{/name}","comments_url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/214/comments","events_url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/214/events","html_url":"https://github.com/ninjaprox/NVActivityIndicatorView/issues/214","id":321489848,"node_id":"MDU6SXNzdWUzMjE0ODk4NDg=","number":214,"title":"startAnimating() isn't working initially","user":{"login":"ANKITASRI04","id":39119252,"node_id":"MDQ6VXNlcjM5MTE5MjUy","avatar_url":"https://avatars1.githubusercontent.com/u/39119252?v=4","gravatar_id":"","url":"https://api.github.com/users/ANKITASRI04","html_url":"https://github.com/ANKITASRI04","followers_url":"https://api.github.com/users/ANKITASRI04/followers","following_url":"https://api.github.com/users/ANKITASRI04/following{/other_user}","gists_url":"https://api.github.com/users/ANKITASRI04/gists{/gist_id}","starred_url":"https://api.github.com/users/ANKITASRI04/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ANKITASRI04/subscriptions","organizations_url":"https://api.github.com/users/ANKITASRI04/orgs","repos_url":"https://api.github.com/users/ANKITASRI04/repos","events_url":"https://api.github.com/users/ANKITASRI04/events{/privacy}","received_events_url":"https://api.github.com/users/ANKITASRI04/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-09T09:07:42Z","updated_at":"2018-07-05T16:06:37Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n I am using a table view and hitting an api in view did load .Initially when I try to show NVIndicator view it is not showing anything but if I refresh table view then it is working in another api.The code I am using is:\r\n NVActivityIndicatorPresenter.sharedInstance.startAnimating(ActivityData())\r\nHow to show the loader in viewDidLoad?"},"comment":{"url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/comments/402773317","html_url":"https://github.com/ninjaprox/NVActivityIndicatorView/issues/214#issuecomment-402773317","issue_url":"https://api.github.com/repos/ninjaprox/NVActivityIndicatorView/issues/214","id":402773317,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjc3MzMxNw==","user":{"login":"tudorpopa39","id":16446036,"node_id":"MDQ6VXNlcjE2NDQ2MDM2","avatar_url":"https://avatars3.githubusercontent.com/u/16446036?v=4","gravatar_id":"","url":"https://api.github.com/users/tudorpopa39","html_url":"https://github.com/tudorpopa39","followers_url":"https://api.github.com/users/tudorpopa39/followers","following_url":"https://api.github.com/users/tudorpopa39/following{/other_user}","gists_url":"https://api.github.com/users/tudorpopa39/gists{/gist_id}","starred_url":"https://api.github.com/users/tudorpopa39/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tudorpopa39/subscriptions","organizations_url":"https://api.github.com/users/tudorpopa39/orgs","repos_url":"https://api.github.com/users/tudorpopa39/repos","events_url":"https://api.github.com/users/tudorpopa39/events{/privacy}","received_events_url":"https://api.github.com/users/tudorpopa39/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T16:06:37Z","updated_at":"2018-07-05T16:06:37Z","author_association":"NONE","body":"I created an protocol like this:\r\n\r\n    public protocol LoadingSpinner : NVActivityIndicatorViewable {}\r\n\r\n    public extension LoadingSpinner where Self: UIViewController{\r\n    \r\n    public func startLoadingAnimation\r\n        (message : String? = nil,\r\n         type: NVActivityIndicatorType? = nil,\r\n         color : UIColor? = nil,\r\n         backgroundColor : UIColor? = nil){\r\n        \r\n        DispatchQueue.main.async(execute: {\r\n            let size = CGSize(width: 50, height: 50)\r\n            let message = message != nil ? message : \"\"\r\n            let color = color ?? Constants.Color.galleryGray\r\n            let type = type ?? Constants.DEFAULT_LOADING_SPINNER_TYPE\r\n            let backgroundColor = backgroundColor ?? nil\r\n            self.startAnimating(size, message: message, type: type,\r\n                                color: color, padding: nil, backgroundColor: backgroundColor)\r\n            \r\n            if UIApplication.shared.isIgnoringInteractionEvents {\r\n                UIApplication.shared.endIgnoringInteractionEvents()\r\n            }\r\n            UIApplication.shared.beginIgnoringInteractionEvents()\r\n        });\r\n    }\r\n    \r\n    public func stopLoadingAnimation(){\r\n        DispatchQueue.main.async(execute :{\r\n            UIApplication.shared.endIgnoringInteractionEvents()\r\n            self.stopAnimating()\r\n        });\r\n    }\r\n    }\r\n\r\nand I extended to the main view controller, and call the _startLoadingAnimation_ in the _viewDidAppear_\r\n\r\n    class ViewController: UIViewController, LoadingSpinner  {\r\n\r\n         override func viewDidLoad() {\r\n              super.viewDidLoad()\r\n         }\r\n\r\n         override func viewDidAppear(_ animated: Bool) {\r\n               super.viewDidAppear(animated)\r\n               self.startLoadingAnimation(backgroundColor: .clear)\r\n         }\r\n    }"}}
{"actor":{"display_login":"tudorpopa39"}}