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

前端 未结 4 1089
走了就别回头了
走了就别回头了 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 10:04

    The identified(by:) method has been deprecated, the correct syntax is now:

    init(Data, id: KeyPath, content: (Data.Element) -> Content)

    or after moving the content into a closure :

    ForEach(state.modes, id: \.self) { mode in Text(mode) }
    

提交回复
热议问题