如何在SwiftUI中将Int值(来自mySQL数据库)转换为Bool值?

我在mySQL数据库中有一个表,该表中需要将变量“ show”从SwiftUI中的Int转换为Bool。

无法直接在SQL中将“ false”声明为字段值-我需要对SwiftUI进行编码,以将该整数解释为布尔值。

The JSON output reads as [ { "establishmentId": 2, "name": "O'Reilly's Pub", "email": "oreillys@email.com", "show" : 0 } ]

In SwiftUI I have a structure called 'Establishment': Establishment Structure.

I receive errors when trying to iterate between the establishments due to the 'show' variable being an integer: Errors, Code Generating the Errors.

在EstablishmentView结构中,我声明“ @Binding var show:Bool”,我认为这就是我的问题所在。

In an APIManager class I call on my API: API Manager, and in a DataStore class I initialize a function to utilize the APIManager: Initialization.

任何人都可以推荐在SwiftUI中将Int转换为Bool数据类型的方法-可以消除我的错误。我希望我已经提供了足够多的代码来使代码清晰,但为了清楚起见,请告知我是否还有更多代码可以提供。