0

I have an UIActivityIndicatorView in the tableview cell.
To display the uploading status.
It works great on my app.
But it never spinning in the share app extension.

class MyCell: UITableViewCell {
  @IBOutlet private var activityIndicator: UIActivityIndicatorView!

  func config(isUploading: Bool) {
    isUploading ? self.activityIndicator.startAnimating(): self.activityIndicator.stopAnimating()
    print("isUploading: \(isUploading), isMainThread: \(Thread.isMainThread)")
    // isUploading : true, isMainThread: true
  }
}

I tried to run this in the dispatch main queue. not work

DispatchQueue.main.async {}
DispatchQueue.main.asyncAfter(deadline: , execute: )

I also tried to add an separate UIActivityIndicatorView in the XIB.
The only work of this new UIActivityIndicatorView is spinning.
It shows on the screen but not spinning.
Seems UIActivityIndicatorView won't spinning in the share app extension.
It is weird

xxi
  • 1,430
  • 13
  • 24

1 Answers1

0

In this view I have another textField.
For better UX, I focus to the textField automatically.

_ = self.textField.becomeFirstResponder()

somehow the becomeFirstResponder will block the animation of UIActivityIndicatorView.
What I can do is don't focus on the textField automatically in some scenarios

No better solution, any suggestion is welcome

xxi
  • 1,430
  • 13
  • 24