Search
 
SCRIPT & CODE EXAMPLE
 

SWIFT

activity indicator swiftui

struct ActivityIndicator: UIViewRepresentable {

    @Binding var isAnimating: Bool
    let style: UIActivityIndicatorView.Style

    func makeUIView(context: UIViewRepresentableContext<ActivityIndicator>) -> UIActivityIndicatorView {
        return UIActivityIndicatorView(style: style)
    }

    func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext<ActivityIndicator>) {
        isAnimating ? uiView.startAnimating() : uiView.stopAnimating()
    }
}

//Usage...
ActivityIndicator(isAnimating: .constant(true), style: .large)
Comment

PREVIOUS NEXT
Code Example
Swift :: swiftui actionsheet 
Swift :: rxswift combine two observables 
Swift :: for loop swift 
Swift :: set in swift 
Swift :: swift screenshot 
Swift :: swft ui image 
Swift :: swiftui popover 
Swift :: dismiss keyboard on tap outside swiftui 
Swift :: swift iterate through string 
Swift :: how can i find range of a string in another string swift 
Swift :: swift array map to another array 
Swift :: Swift Trailing Closure 
Swift :: Swift Character Example 
Swift :: Swift Class and Objects 
Swift :: swift resource exceeds maximum size 
Swift :: swift view 
Swift :: Optional & Default Parameter Swift 
Swift :: printf in swift 
Swift :: Working of Recursion in Swift 
Swift :: Swift Computed Property In Extension 
Swift :: how to darken view swiftui 
Swift :: swift core data order by 
Swift :: Autoclosure Swift 
Swift :: Swift Loop Statements 
Swift :: swift dictionary to json string online 
Swift :: swift split an array into chunks 
Swift :: Swift Bitwise OR Operator 
Swift :: swift ge array item from indexset 
Ruby :: rails skip authenticity token 
Ruby :: convert string to hash ruby 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =