Data wont be added to realtime database (firebase)


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() {
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]

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?