title: Issues While Trying To Recreate SwiftUI-based App From WWDC Session
body: <p>I am trying to recreate the SwiftUI project demonstrated in Session 204  but am running into some peculiar issues.</p>
  
  <p>I wrote this from watching the session found here: <a href="https://developer.apple.com/videos/play/wwdc2019/204" rel="noreferrer">https://developer.apple.com/videos/play/wwdc2019/204</a></p>
  
  <p>Here is my code-</p>
  
  <p>ContentView.swift:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  struct ContentView : View {
      @ObjectBinding var store = RoomStore()
  
      var body: some View {
          NavigationView {
              List {
                  Section {
                      Button(action: addRoom) {
                          Text("Add Room")
                      }
                  }
  
                  Section {
  
                      ForEach(store.rooms) { room in //Error: Cannot convert value of type '(Room) -&gt; RoomCell' to expected argument type '(_) -&gt; _'
                          RoomCell(room: room)
                      }
                      .onDelete(perform: delete)
                      .onMove(perform: move)
                  }
              }
              .navigationBarTitle(Text("Rooms") )
              .NavigationBarItems(trailing: EditButton())
              .listStyle(.grouped)
          }
      }
  
      func addRoom() {
          store.rooms.append(Room(name: "Hall 2", capacity: 2000))
      }
      func delete(at offsets: IndexSet) {
          store.rooms.remove(atOffsets: offsets) //Error: Incorrect argument label in call (have 'atOffsets:', expected 'at:')
      }
      func move(from source: IndexSet, to destination: Int) {
          store.rooms.move(fromOffsets: source, toOffset: destination) //Error: Value of type '[Room]' has no member 'move'; did you mean 'remove'?
      }
  }
  
  #if DEBUG
  struct ContentView_Previews : PreviewProvider {
      static var previews: some View {
          Group {
              ContentView(store: RoomStore(rooms: testData))
              ContentView(store: RoomStore(rooms: testData))
              .environment(\.sizeCategory, .extraExtraExtraLarge)
              ContentView(store: RoomStore(rooms: testData))
              .environment(\.colorScheme, .dark)
              ContentView(store: RoomStore(rooms: testData))
              .environment(\.layoutDirection, .rightToLeft)
              .environment(\.locale, Locale(identifier: "ar"))
          }
      }
  }
  #endif
  struct RoomCell : View {
      let room: Room
      var body: some View {
          return NavigationButton(destination: RoomDetail(room: room) )
          {
              Image(room.thumbnailName)
              .cornerRadius(8)
              VStack(alignment: .leading) {
                  Text (room.name)
                  Text ("\(room.capacity) peopje")
                      .font(.subheadline)
                      .foregroundColor(.secondary)
              }
          }
      }
  }
  </code></pre>
  
  <p>Room.swift:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  
  struct Room {
      var id = UUID()
      var name: String
      var capacity: Int
      var hasVideo: Bool = false
      var imageName: String { return name }
      var thumbnailName: String { return name + "Thumb" }
  
  }
  
  #if DEBUG
  
  let testData = [
      Room(name: "Observation Deck", capacity: 6, hasVideo: true),
      Room(name: "Executive Suite", capacity: 8, hasVideo: false),
      Room(name: "Charter Jet", capacity: 16, hasVideo: true),
      Room(name: "Dungeon", capacity: 10, hasVideo: true),
      Room(name: "Panorama", capacity: 12, hasVideo: false),
      Room(name: "Oceanfront", capacity: 8, hasVideo: false),
      Room(name: "Rainbow Room", capacity: 10, hasVideo: true),
      Room(name: "Pastoral", capacity: 7, hasVideo: false),
      Room(name: "Elephant Room", capacity: 1, hasVideo: false),
  
  ]
  
  #endif
  </code></pre>
  
  <p>RoomDetail.swift:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  struct RoomDetail : View {
      let room: Room
      @State private var zoomed = false
      var body: some View { //Error: Function declares an opaque return type, but has no return statements in its body from which to infer an underlying type
          ZStack(alignment: .topLeading) {
              Image(room.imageName )
                  .resizable()
                  .aspectRatio(contentMode: zoomed ? .fill : .fit)
                  .navigationBarTitle(Text(room.name), displayMode:
                      .inline)
                  .tapAction { withAnimation(.basic(duration: 2)) {
                      self.zoomed.toggle() } }
              }
              .frame(minWidth: 0, maxWidth: .infinity, minHeight:
                  0, maxHeight: .infinity)
              if room.hasVideo &amp;&amp; !zoomed {
                  Image(systemName: "video. fill")
                      .font(.title)
                      .padding(.all)
                      .transition(.move(edge: .leading) )
              }
          }
  }
  
  #if DEBUG
  struct RoomDetail_Previews : PreviewProvider {
      static var previews: some View {
          Group {
              NavigationView { RoomDetail(room: testData[0]) }
              NavigationView { RoomDetail(room: testData[1]) }
          }
  }
  }
  #endif
  </code></pre>
  
  <p>RoomStore.swift:</p>
  
  <pre class="lang-swift prettyprint-override"><code>import SwiftUI
  import Combine
  
  class RoomStore : BindableObject {
      var rooms: [Room] {
          didSet { didChange.send(Void()) } //Solved
      }
      init(rooms: [Room] = []) {
          self.rooms = rooms
      }
      var didChange = PassthroughSubject&lt;Void, Never&gt;()
  }
  </code></pre>
  
  <p>Error messages included in context, as comments, in above code.</p>