How to remove highlight on tap of List with SwiftUI?

前端 未结 6 872
悲哀的现实
悲哀的现实 2020-12-30 01:19

How to remove highlight on tap of List with SwiftUI?

List {

}.whatModifierToAddHere?

The selection manager documentation doesnt say anythi

6条回答
  •  轮回少年
    2020-12-30 01:39

    Edit:

    The following only works if the SwiftUI view is embedded in a UIKit parent.



    For anyone still wondering, you can use .onAppear modifier to achieve this.

    .onAppear {
                UITableViewCell.appearance().selectionStyle = .none
        }
    

    This is similar to viewWillAppear in UIKit. Source: HackingWithSwift

提交回复
热议问题