exyte / AnimatedTabBar

A tabbar with a number of preset animations written in pure SwiftUI
https://exyte.com/
MIT License
380 stars 26 forks source link

Unable to use binding #3

Closed Benetos closed 1 year ago

Benetos commented 1 year ago

Just downloaded the library and was setting up a basic tab bar to mess around with.

`import SwiftUI import AnimatedTabBar

struct AnimatedTabBar: View { @State var selectedIndex = 0 var body: some View { AnimatedTabBar(selectedIndex: $selectedIndex) } }

struct AnimatedTabBar_Previews: PreviewProvider { static var previews: some View { AnimatedTabBar() } }`

However it is producing an error saying "Cannot convert value '$selectedIndex' of type 'Binding' to expected type 'Int', use wrapped value instead" and it wants me to to remove the binding. If I remove the binding the error goes away but I get a crash when I try to run the preview in the canvas.

Benetos commented 1 year ago

Hey @f3dm76 just an update but I tried to clean the build folder and restart Xcode. For some reason the error now says "Argument passed to call that takes no arguments". I tried to just copy the code for the wiggle button and the color helper right out of the cloned GitHub example project. That project builds correctly and runs correctly with out any complaints.

I also compared the settings in the package file and pod files of the example project and mine and they are identical. Seems like the issue might be with my Xcode but honestly I have no idea what's going on with it.

f3dm76 commented 1 year ago

Hey @Benetos I think the problem might be that you are using the same name for your struct 'AnimatedTabBar'. Have a nice day