Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Records {
- let title: String
- let source: String
- var length: String
- let recordUrl: String
- let username: String
- init(dictionary: [String: Any]) {
- self.title = dictionary["title"] as? String ?? ""
- self.source = dictionary["source"] as? String ?? ""
- self.length = dictionary["length"] as? String ?? ""
- self.recordUrl = dictionary["recordUrl"] as? String ?? ""
- self.username = dictionary["username"] as? String ?? ""
- }
- }
- var records = [Records]()
- func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
- guard let uid = Auth.auth().currentUser?.uid else { return }
- if (editingStyle == .delete) {
- records.remove(at: indexPath.item)
- tableView.deleteRows(at: [indexPath], with: .fade)
- Database.database().reference().child("users").child(uid).child("records").removeValue()
- }
- }
Add Comment
Please, Sign In to add comment