-1

I created a share extension for my application in Swift. Now I have to call an API and send the title and image to the server. I am able to call the API from the didSelectPost method of ShareViewController but it is taking some time to complete the upload. My question is how can I show a progress bar or an activity indicator over there so that I can show to user that something is happening? Like in this image.

Also, can you please tell me the significance of the method completeRequestReturningItems([], completionHandler:)? I read the documentation of this method but I can not use it in my application.

Christopher Graf
  • 1,929
  • 1
  • 17
  • 34
Somenath
  • 19
  • 1
  • 6

1 Answers1

0
  1. Drag drop activity indicator in your interface builder.
  2. Set it horizontally and vertically in container from there.
  3. Create its outlet as "@iboutlet weak var ibactivity : UIActivity..".
  4. On hit of api, call ibactivity.startAnimating()' & also write self.view.isUserInteractionEnabled = false if reqd.
  5. On success or failure of response ibactivity.stopAnimating() and set it hidden.

you are done..!!

Anas Mehar
  • 2,739
  • 14
  • 25