swift3 - My Image stop animation when I do a request in swift 3 -


i've got uimage, needs rotate until call server ends. image rotates 1 time , stops after that.

my code:

    @iboutlet var imgloader: uiimageview!     override func viewdidload() {     super.viewdidload()     dispatchqueue.global(qos: .userinitiated).async {         self.getsalons()     }     self.launchloaderdesign()     notificationcenter.default.addobserver(forname:nsnotification.name("loadallshownotification"), object: nil, queue: nil, using: notificationfinish) }  func getsalons() -> void {     let api:apisvain = apisvain()     api.getheartstrokesalon()     api.getsalonforhomepage() }  func launchloaderdesign() -> void {     var posimg:int = 0     uiview.animate(withduration: 0.5, delay: 0, options: .curveeasein, animations: { () -> void in             self.imgloader.transform = self.imgloader.transform.rotated(by: cgfloat(m_pi_2))     })     { (finished) -> void in         self.launchloaderdesign()     } } func getsalonforhomepage(){     let url = "my_url"     alamofire.request(url, method: .get).validate().responsejson     { response in         if (response.error == nil)         {             let json = json(response.result.value!)              (index, element) in json             {                 let show:show = show(json: element, index: index)                 staticdata.arrayofshow.append(show)             }             notificationcenter.default.post(name:nsnotification.name("loadallshownotification"), object: nil, userinfo: nil)         }         else         {             print(response.error!)         }     } } 

my function getsalonforhomepage sends notification, , when catch use performsegue move new page.

i think problem came misunderstanding of multi-threading.

ps: using alamofire 4, send request server.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -