Skip to content

Instantly share code, notes, and snippets.

@longlongjump
Created November 15, 2019 08:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save longlongjump/096ade4ed3472e4a61686b66d2429995 to your computer and use it in GitHub Desktop.
Save longlongjump/096ade4ed3472e4a61686b66d2429995 to your computer and use it in GitHub Desktop.
extension UITableViewCell {
@objc func toggleDisclosureIndicator(show: Bool) {
guard #available(iOS 13, *) else {
self.accessoryType = show ? .disclosureIndicator : .none
return
}
guard show else {
accessoryView = nil
return
}
let conf = UIImage.SymbolConfiguration(pointSize: 14, weight: .semibold)
guard let image = UIImage(systemName: "chevron.right")?.withConfiguration(conf) else {
return
}
let imageView = UIImageView(image: image)
imageView.frame = CGRect(x: 0, y: 0, width: 12, height: 15)
imageView.contentMode = .scaleAspectFit
accessoryView = imageView
accessoryView?.tintColor = UIColor(red: 199/255.0, green: 199/255.0, blue: 204/255.0, alpha: 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment