From bf7c7e71449b7be0c8b9d66c3d3750ecbb7e22a9 Mon Sep 17 00:00:00 2001 From: Victor Bodinaud Date: Mon, 14 Feb 2022 16:19:21 +0100 Subject: [PATCH] add init to Account & Transaction --- Sources/Blockchain/Models/Account.swift | 5 +++++ Sources/Blockchain/Models/Transaction.swift | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/Sources/Blockchain/Models/Account.swift b/Sources/Blockchain/Models/Account.swift index 14b5d0b..5c49cac 100644 --- a/Sources/Blockchain/Models/Account.swift +++ b/Sources/Blockchain/Models/Account.swift @@ -10,4 +10,9 @@ import Foundation class Account { var id: String var balance: Int + + init(id: String, balance: Int) { + self.id = id + self.balance = balance + } } diff --git a/Sources/Blockchain/Models/Transaction.swift b/Sources/Blockchain/Models/Transaction.swift index 681971f..5390c98 100644 --- a/Sources/Blockchain/Models/Transaction.swift +++ b/Sources/Blockchain/Models/Transaction.swift @@ -12,4 +12,11 @@ class Transaction { var receiver: String var amount: Int var type: String + + init(sender: String, receiver: String, amount: Int, type: String) { + self.sender = sender + self.receiver = receiver + self.amount = amount + self.type = type + } }