在SwiftUI中将可访问性标识符设置为ActionSheet按钮

时间:2020-04-02 13:28:32

标签: swift swiftui ui-testing

如何在SwiftUI中将可访问性标识符设置为ActionSheet按钮?

我尝试将其设置为Text,但显示错误“无法将'ModifiedContent'类型的值转换为预期的参数类型'Text'”

ActionSheet(
        title: Text("onboarding_nationality_country_select".localized),
        buttons: [
            .default(Text("Austria").accessibility(identifier: "first_item"), action: {
                self.interactor.selectCountry(with: "Austria")
                self.countryListActive = false
                }),
            .default(Text("Germany"), action: {
                self.interactor.selectCountry(with: "Germany")
                self.countryListActive = false
            }),
            .cancel(Text("common_cancel".localized), action: {
                self.countryListActive = false
            })
        ])
}

0 个答案:

没有答案