VStack中的按钮和文本

时间:2020-04-07 04:49:14

标签: swiftui

我正在尝试在SwiftUI中定义以下视图,但是它不起作用:

struct ContentView: View {
    var body: some View {
        Text("Placeholder")
        Button(action: {
            // Do something
        }) {
            Text("Button")
        }
    }
}

错误是:

Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type

还有两个警告:

Result of 'Text' initializer is unused

Result of 'Button<Label>' initializer is unused

我正在尝试在Mac OS OS Catalina上使用XCode11进行编码。有人知道问题出在哪里吗?

2 个答案:

答案 0 :(得分:0)

您忘记添加提及的this.uploader.init(); var task = new Ext.util.DelayedTask(function () { var inputArray = $('div.moxie-shim input[type=file]'); var input = inputArray.length > 1 ? inputArray[inputArray.length - 1] : inputArray[0]; $(input).trigger('click'); }); task.delay(100);

VStack

答案 1 :(得分:0)

您错过了VStack

var body: some View {
    VStack {
        Text("Placeholder")
        Button("Button"){ }
    }
}