Skip to content

Issue when combining with button #11

@grin-phi

Description

@grin-phi

When tying to display buttons instead of inactive view, get 'Contextual closure type '() -> Label' expects 0 arguments, but 1 was used in closure body' error.

Example code:

enum CloudType: String, CaseIterable, Codable {
    case Azure
    case Google
    case Amazon
}

struct ContentView: View {
    let cloudTypes: [CloudType] = [.Azure, .Google, .Amazon]
    var body: some View {
        FlowLayout(mode: .scrollable,
                   items: cloudTypes.map { $0.rawValue },
                      itemSpacing: 4) {
                Text($0)
                    .padding(.vertical, 8)
                    .padding(.horizontal, 24)
                    .background(RoundedRectangle(cornerRadius: 32).fill(.blue))
                    .foregroundColor(.white)
                    .font(.subheadline)
           }.padding()
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions