Activity indicator in SwiftUI

后端 未结 9 2027
忘了有多久
忘了有多久 2020-11-29 17:36

Trying to add a full screen activity indicator in SwiftUI.

I can use .overlay(overlay: ) function in View Protocol.

With this, I c

9条回答
  •  南方客
    南方客 (楼主)
    2020-11-29 18:16

    iOS 14 - Native

    it's just a simple view.

    ProgressView()
    

    Currently, it's defaulted to CircularProgressViewStyle but you can manually set the style of it by adding the following modifer:

    .progressViewStyle(CircularProgressViewStyle())
    

    Also, the style could be anything that conforms to ProgressViewStyle


    iOS 13 - Fully customizable Standard UIActivityIndicator in SwiftUI: (Exactly as a native View):

    You can build and configure it (as much as you could in the original UIKit):

    ActivityIndicator(isAnimating: loading)
        .configure { $0.color = .yellow } // Optional configurations (

提交回复
热议问题