Data wont be added to realtime database (firebase)

Hi,

when i try to add a persons information through the app, it wont get added to the database, i tried following a tutorial on youtube that i found, however it wont work heres the code

       import UIKit
        import Firebase
         import FirebaseDatabase



     class addViewController: UIViewController {

var refrelation : DatabaseReference!

@IBOutlet weak var relation: UITextField!
@IBOutlet weak var dOB: UITextField!
@IBOutlet weak var lastname: UITextField!
@IBOutlet weak var firstName: UITextField!

@IBAction func addName(_ sender: UIButton) {
}

override func viewDidLoad() {
    super.viewDidLoad()
    
refrelation = Database.database().reference().child("FirstName");
}
    
    // Do any additional setup after loading the view.

func addName() {
    let key = refrelation.childByAutoId().key
    let relationn = [ "id":key,"firstName": firstName.text! as String, "lastname" : lastname.text! as String, "Relation": relation.text! as String, "DOB": dOB.text! as String]
    refrelation.child(key!).setValue(relationn)
}

where am I going wrong? please help me out here, it’ll mean the world to me. I’m pretty new to swift.

have you tried checking out chris’ firestore tutorial? https://www.youtube.com/watch?v=P1cNScXGlVI&list=PLMRqhzcHGw1ZsFRLAWa_Axx7daXteynjh