dkk / WrappingHStack

A SwiftUI HStack with the ability to wrap contained elements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WrappingHStack crashes in iOS 16 for iPhone but not iPad

quinn305 opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

WrappingHStack crashes in iOS 16 for iPhone but not iPad. When a Navigation Link to a View using WrappingHStack is clicked, this happens on all iOS 16 iPhone versions tried

commented

Looks like we have a similar issue?
#27

@ViewBuilder
func DragArea() -> some View {

    WrappingHStack(shuffledWords, id: \.self, alignment: .center) { item in
        
        Text("\(item.word)")
            .blueBackground()
            .overlay(RoundedRectangle(cornerRadius: 15).style(
                withStroke: Color.white,
                lineWidth: 10,
                fill: item.isPlaced ? Color.gray: Color.clear
            ))
            //MARK: Adding Drag Operation
            .onDrag {
                print(item.id!)
                return .init(contentsOf: URL(string: item.id!))!
            }
            
            
    }
    
}

@ViewBuilder
func DropArea() -> some View {
    
    WrappingHStack($dragdropWords, id: \.self, alignment: .center) { $item in
        Text("\(item.word)")
            .blueBackground()
            .overlay(RoundedRectangle(cornerRadius: 15).style(
                withStroke: Color.white,
                lineWidth: 10,
                fill: !item.isPlaced ? Color.gray: Color.clear
            ))
            
            .onDrop(of: ["public.url"], isTargeted: .constant(false)) {
                providers in

                if let first = providers.first  {
                    let _ = first.loadObject(ofClass: URL.self) { value, error in
                        
                        guard let url = value else {return}
                        
                        if item.id == "\(url)" {
                            droppedCount += 1
                            let progress = (droppedCount / CGFloat(dragdropWords.count))
                            withAnimation {
                                item.isPlaced = true
                                updateShuffledArray(dragDropWord: item)
                                self.progress = progress
                            }
                        }
                         
                    }
                }
                
                return false
            }
    }
    
}

Above is my code using WrappingHStack. Perhaps we do have similar issue

commented

I guess this package is dead since owner removed their assignment from all reported bugs without any comments.

Closing for now, if you still have this issues 2.2.3, please reopen.