我尝试了很多不同的方法,但没有一个有效,当我尝试添加 .onChange 时,我收到此错误
Instance method 'onChange(of:perform:)' requires that 'Binding<Int>' conform to 'Equatable'
Run Code Online (Sandbox Code Playgroud)
我这样定义 currentTab
@State var currentTab = 0;
Run Code Online (Sandbox Code Playgroud)
这段代码给出了错误
.onChange(of: $currentTab, perform: { newValue in
print(newValue)
})
Run Code Online (Sandbox Code Playgroud)