Friday, August 19, 2022
HomeiOS Developmentios - The right way to use Multi NavigationLink in One Cell...

ios – The right way to use Multi NavigationLink in One Cell of Record?


NavigationLink in Record is robotically designed.

The right way to set applicable multi NavigationLink in Cell?

I do not need use ForEach in ScrollView. As a result of I wish to use swipeActions.

struct TimelineView: View {
  let tweets: [Tweet] = tweets
  let customers: [User] = customers

  var physique: some View {
    NavigationStack {
      Record(tweets) { tweet in
        let consumer = customers.first { $0.id == tweet.userID }!

        NavigationLink(worth: tweet) {
          HStack {
            NavigationLink(worth: consumer) {
              Picture(systemName: "individual")
                .foregroundStyle(consumer.colour)
            }

            VStack {
              Textual content("@(consumer.title)")
              Textual content(tweet.textual content)
            }
          }
        }
        .swipeActions(edge: .main) {
          Button("Like") { }
        }
      }
      .navigationDestination(for: Tweet.self) { tweet in
        TweetDetailView(tweet: tweet)
      }
      .navigationDestination(for: Consumer.self) { consumer in
        UserDetailView(consumer: consumer)
      }
    }
  }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments