Giter Club home page Giter Club logo

Comments (6)

f3dm76 avatar f3dm76 commented on July 20, 2024

Hey @AngelDev727, what is a modal loading? Can you please provide more details?

from activityindicatorview.

AngelDev0329 avatar AngelDev0329 commented on July 20, 2024

simulator_screenshot_35FCF3AA-0277-4EDD-93E0-1BD965E5FBAF

I meant this ActivityIndicator on modal view.

from activityindicatorview.

f3dm76 avatar f3dm76 commented on July 20, 2024

Have you tried using a .sheet and displaying your activity indicator there?

from activityindicatorview.

AngelDev0329 avatar AngelDev0329 commented on July 20, 2024

No, I haven't tried using .sheet

from activityindicatorview.

zooxop avatar zooxop commented on July 20, 2024

Hi, @AngelDev727 :)

I think you can make simply using ZStack and additional View components the modal screen you want.
Hereโ€™s an simple example that Iโ€™m using in a field project.

import SwiftUI
import ActivityIndicatorView

struct ContentView: View {
    @State private var isVisible = false
    
    var body: some View {
        ZStack {
            VStack {
                Button {
                    self.isVisible.toggle()
                } label: {
                    Text("Modal On/Off")
                }
            }
            .padding()
            
            VStack {
                ZStack {
                    RoundedRectangle(cornerRadius: 20)
                        .fill(Color.white)
                        .frame(width: 100, height: 100)
                        
                    ActivityIndicatorView(isVisible: $isVisible, type: .default())
                        .frame(width: 50.0, height: 50.0)
                        .foregroundColor(Color.blue)
                }
            }
            .frame(maxWidth: .infinity, maxHeight: .infinity)
            .background(Color.gray.opacity(0.3))
            .ignoresSafeArea()  // need iOS 14.0 later
            .isHidden(!isVisible)
            .onTapGesture {
                self.isVisible.toggle()
            }
        }
    }
}

extension View {
    @ViewBuilder func isHidden(_ isHidden: Bool) -> some View {
        if isHidden {
            self.hidden()
        } else {
            self
        }
    }
}

image

I hope it can help you.

have a good day. :)

from activityindicatorview.

AngelDev0329 avatar AngelDev0329 commented on July 20, 2024

It works as well.
Thank you

from activityindicatorview.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.