swiftui-drawer icon indicating copy to clipboard operation
swiftui-drawer copied to clipboard

Working in xcode 13?

Open tcollins590 opened this issue 4 years ago • 4 comments

I am receiving the following error

Cannot convert value of type '[Int]' to expected argument type 'Binding<[CGFloat]>'

tcollins590 avatar Oct 30 '21 02:10 tcollins590

Thanks for pointing this out. The docs are outdated, and the parameter should be a binding CGFloat array, not an Int array. Try using .constant([...]) with your numbers inside there, like in this example.

maustinstar avatar Oct 30 '21 18:10 maustinstar

I tried to use this today and despite resolving all issues and using this example, all i got was an empty app. I don't think it's working out of the box in xcode 13

Drawer {
    ZStack {
        
        RoundedRectangle(cornerRadius: 12)
            .foregroundColor(.white)
            .shadow(radius: 100)
        
        VStack(alignment: .center) {
            Spacer().frame(height: 4.0)
            RoundedRectangle(cornerRadius: 3.0)
                .foregroundColor(.gray)
                .frame(width: 30.0, height: 6.0)
            Spacer()
        }
    }
}.edgesIgnoringSafeArea(.vertical)
.rest(at: .constant([100, 340, UIScreen.main.bounds.height - 40]))
.impact(.light)

mattpilott avatar Nov 17 '21 15:11 mattpilott

Confirmed, if you create a new project and add the example code to it you get an empty app, even if you adjust for the @Binding like you mentioned. This project doesn't seem to work at all anymore.

CaryAndo avatar Jan 18 '22 03:01 CaryAndo

The code snipped from documentation doesn't work on Xcode 14 but following does:

Drawer(heights: .constant([100, 340])) {
    Color.blue
}.edgesIgnoringSafeArea(.vertical)

josipbernat avatar Apr 25 '23 12:04 josipbernat