Using ForEach with a string array - [String] has no member 'identified'

前端 未结 4 1085
走了就别回头了
走了就别回头了 2021-01-22 08:58

I\'m using Xcode 11 beta 5 and what I had it doesn\'t work anymore. This is my code:

struct ModeView : View {
  @EnvironmentObject var state: IntentionState

  v         


        
4条回答
  •  灰色年华
    2021-01-22 09:46

    let suppose you have a name array like this:

    let names = ["mike","Jack","jill"]
    
    ForEach(names, id: \.self) { Text($0) }
    

    Text($0) - this will print all elements from your names array.

    Note:

    Use backslashsign.self instead .self, somehow backslash sign is not working here

提交回复
热议问题