opened
kevinonik
username_0
Hello,

First of all great work. I just made a wrapper for webservice calling using alamofire. I need to insert your library in that wrapper but since you used it for uiviewcontroller only it is quite not achievable by me. Can you help me out.


`


        
          class func serviceCall(urlEnum: URLRequestConvertible, vC : UIViewController, success:(JSON) -> Void, failure:(NSError) -> Void) {**
          
          let size = CGSize(width: 30, height:30)
           vC.startActivityAnimating(size, message: "Loading...", type: NVActivityIndicatorType(rawValue: 9)!)
      
        
       
        Alamofire.request(urlEnum).responseJSON { (responseObject) -> Void in
            
            print(responseObject)
            
            if responseObject.result.isSuccess {
                let resJson  = JSON(responseObject.result.value!)
                success(resJson)
            }
            if responseObject.result.isFailure {
                let error : NSError = responseObject.result.error!
                failure(error)
            }
        }
    }`


Above is my a function in my wrapper class.
How to add this in an object file rather than using it in view controllers
issue
created
ninjaprox
username_1
@username_0: I'm not sure why the above snippet doesn't work for you, could you explain more? Apart from `UIViewController`, you can purely create `NVActivityIndicatorView` which is subclass of `UIView`and use it by your own way.
comment
created
dernster
username_2
@username_0 you can create a dummy view controller like

```swift
class PresenterViewController: UIViewController, NVActivityIndicatorViewable { }
```

and then use it from anywhere:

```swift
let presenter = PresenterViewController()
presenter.startActivityAnimating(...)
```

Since the current implementation of the start and stop activity functions don't really need anything from the view controller maybe the framework should also expose those methods from a singleton instance or something like that. What do you think?
comment
created
ninjaprox
username_1
Well I think decoupling it from view controller is good idea. With `PresenterViewController` user can display UI blocker wherever and still have convenient call from `UIViewController` that conforms `NVActivityIndicatorViewable`.
comment
created
kevinonik
username_0
Thanks
comment
closed
ninjaprox
username_1
issue