HomeiOS Developmentios - The right way to obtain animation much like App retailer's...

ios – The right way to obtain animation much like App retailer’s characteristic view


enter image description hereI’m utilizing following code, This works completely fantastic however its full display screen, nonetheless in case of App Retailer animation, its not full display screen view. I’ve tried popover and customized view as nicely however didnt work.

struct ContentView: View {
    let icons = [
        Icon(id: "figure.badminton", color: .red),
        Icon(id: "figure.fencing", color: .orange),
        Icon(id: "figure.gymnastics", color: .green),
        Icon(id: "figure.indoor.cycle", color: .blue),
        Icon(id: "figure.outdoor.cycle", color: .purple),
        Icon(id: "figure.rower", color: .indigo),
    ]

    @Namespace var animation
    @State non-public var chosen: Icon?

    var physique: some View {
        ZStack {
            LazyVGrid(columns: [.init(.adaptive(minimum: 100, maximum: 300))]) {
                ForEach(icons) { icon in
                    Button {
                        chosen = icon
                    } label: {
                        Picture(systemName: icon.id)
                    }
                    .foregroundStyle(icon.coloration.gradient)
                    .font(.system(dimension: 100))
                    .background(Coloration.yellow.opacity(0.5))
                    .matchedTransitionSource(id: icon.id, in: animation)
                }
            }
            .sheet(merchandise: $chosen, content material: { icon in
                VStack(content material: {
                    DestinationView(icon: icon, animation: animation)
                        .background(Coloration.yellow.opacity(0.5))
                        .presentationDetents([.medium])
                })
            })
            .background(Coloration.yellow.opacity(0.5))
        }
        .background(.yellow)
        .ignoresSafeArea(.all)
       
    }
}

The view which shall be offered is

struct DestinationView: View {
    var icon: Icon
    var animation: Namespace.ID
   var physique: some View {
        Picture(systemName: icon.id)
            .font(.system(dimension: 200))
            .body(width: 250, peak: 250)
            .foregroundStyle(icon.coloration.gradient)
            .background(Coloration.yellow.opacity(0.5))
            .navigationTransition(.zoom(sourceID: icon.id, in: animation))
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments