commented the code and removed self.
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
f5c1a64e40
commit
c127a6c465
@ -8,8 +8,11 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
/// ViewModel that will be used along with the EmployeeTableViewCell.
|
||||||
@MainActor
|
@MainActor
|
||||||
public class EmployeeCellViewModel: ObservableObject {
|
public class EmployeeCellViewModel: ObservableObject {
|
||||||
|
// MARK: - Properties
|
||||||
|
|
||||||
private let employee: Employee
|
private let employee: Employee
|
||||||
|
|
||||||
public private(set) var uuid: String
|
public private(set) var uuid: String
|
||||||
@ -21,18 +24,21 @@ public class EmployeeCellViewModel: ObservableObject {
|
|||||||
public private(set) var employeeType: String
|
public private(set) var employeeType: String
|
||||||
@Published public private(set) var smallPhoto: UIImage?
|
@Published public private(set) var smallPhoto: UIImage?
|
||||||
|
|
||||||
|
// MARK: - Initializer
|
||||||
|
|
||||||
public init(employee: Employee) {
|
public init(employee: Employee) {
|
||||||
self.employee = employee
|
self.employee = employee
|
||||||
|
|
||||||
// Initialize properties
|
// Initialize properties
|
||||||
self.uuid = employee.uuid.uuidString
|
uuid = employee.uuid.uuidString
|
||||||
self.fullName = employee.fullName
|
fullName = employee.fullName
|
||||||
self.phoneNumber = employee.phoneNumber?.formatUSNumber()
|
phoneNumber = employee.phoneNumber?.formatUSNumber()
|
||||||
self.emailAddress = employee.emailAddress
|
emailAddress = employee.emailAddress
|
||||||
self.biography = employee.biography
|
biography = employee.biography
|
||||||
self.team = employee.team
|
team = employee.team
|
||||||
self.employeeType = employee.employeeType.description
|
employeeType = employee.employeeType.description
|
||||||
|
|
||||||
|
// Fetch the image for the url if it exists
|
||||||
if let endpoint = employee.photoURLSmall {
|
if let endpoint = employee.photoURLSmall {
|
||||||
Task{
|
Task{
|
||||||
if let smallPhotoURL = URL(string: endpoint) {
|
if let smallPhotoURL = URL(string: endpoint) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user