Skip to content

Commit 76d0be9

Browse files
authored
Merge pull request #28 from lauramarson/finalChanges
Final changes
2 parents 1ea631e + d8ab60d commit 76d0be9

13 files changed

Lines changed: 101 additions & 87 deletions

File tree

AnimalsApp/AnimalsApp.xcodeproj/project.pbxproj

Lines changed: 24 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
56CADB59A535B3ED60380013 /* Pods_AnimalsApp_AnimalsAppUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A1E75A013A1B19FF9D2B114B /* Pods_AnimalsApp_AnimalsAppUITests.framework */; };
10+
194684F53D675326201633D5 /* Pods_AnimalsApp_AnimalsAppUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E781F8CAEBD95B309C5ED221 /* Pods_AnimalsApp_AnimalsAppUITests.framework */; };
1111
5CA996F8285A98FB00FF5D79 /* RegisterViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CA996F7285A98FB00FF5D79 /* RegisterViewModel.swift */; };
12-
A2A6AE83CC0E1DAC784999B1 /* Pods_AnimalsAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 290D574622CE042567539136 /* Pods_AnimalsAppTests.framework */; };
12+
7190DF5ECD0BD55D0EC34B92 /* Pods_AnimalsApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 63095FFEF659AB2D2D5B8CDB /* Pods_AnimalsApp.framework */; };
13+
7E7F56C054B69DA598C658E9 /* Pods_AnimalsAppTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E32E9AF5724341E6FA29909 /* Pods_AnimalsAppTests.framework */; };
1314
A458A086285E58CC0057BC34 /* FavoritesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A458A085285E58CC0057BC34 /* FavoritesViewModel.swift */; };
1415
A458A08C2860BD2D0057BC34 /* Alert+UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A458A08B2860BD2D0057BC34 /* Alert+UIViewController.swift */; };
1516
A458A0922860F7C40057BC34 /* success.json in Resources */ = {isa = PBXBuildFile; fileRef = A458A0912860F7C40057BC34 /* success.json */; };
@@ -18,8 +19,6 @@
1819
A458A09828622EA90057BC34 /* CoreDataMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = A458A09728622EA90057BC34 /* CoreDataMock.swift */; };
1920
A458A09E28628B600057BC34 /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A458A09C28628B600057BC34 /* FavoritesViewController.swift */; };
2021
A458A09F28628B600057BC34 /* FavoritesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A458A09D28628B600057BC34 /* FavoritesViewController.xib */; };
21-
A458A0A0286351670057BC34 /* Pods_AnimalsApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9D1DC7AE05F709A3F0E450DA /* Pods_AnimalsApp.framework */; };
22-
A458A0A1286351670057BC34 /* Pods_AnimalsApp.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9D1DC7AE05F709A3F0E450DA /* Pods_AnimalsApp.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
2322
A463D0172858EBBB00929A3C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D0162858EBBB00929A3C /* AppDelegate.swift */; };
2423
A463D0212858EBBB00929A3C /* AnimalsApp.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = A463D01F2858EBBB00929A3C /* AnimalsApp.xcdatamodeld */; };
2524
A463D0232858EBBD00929A3C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A463D0222858EBBD00929A3C /* Assets.xcassets */; };
@@ -66,31 +65,16 @@
6665
};
6766
/* End PBXContainerItemProxy section */
6867

69-
/* Begin PBXCopyFilesBuildPhase section */
70-
A458A0A2286351670057BC34 /* Embed Frameworks */ = {
71-
isa = PBXCopyFilesBuildPhase;
72-
buildActionMask = 2147483647;
73-
dstPath = "";
74-
dstSubfolderSpec = 10;
75-
files = (
76-
A458A0A1286351670057BC34 /* Pods_AnimalsApp.framework in Embed Frameworks */,
77-
);
78-
name = "Embed Frameworks";
79-
runOnlyForDeploymentPostprocessing = 0;
80-
};
81-
/* End PBXCopyFilesBuildPhase section */
82-
8368
/* Begin PBXFileReference section */
84-
290D574622CE042567539136 /* Pods_AnimalsAppTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsAppTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8569
2DCF7719AB858998955D44F5 /* Pods-AnimalsApp-AnimalsAppUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsApp-AnimalsAppUITests.release.xcconfig"; path = "Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests.release.xcconfig"; sourceTree = "<group>"; };
8670
4DF5AC84080C5CAD4EFD22DD /* Pods-AnimalsApp-AnimalsAppUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsApp-AnimalsAppUITests.debug.xcconfig"; path = "Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests.debug.xcconfig"; sourceTree = "<group>"; };
8771
5955E4FFC7C4BE50ACCA87B4 /* Pods-AnimalsApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsApp.debug.xcconfig"; path = "Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp.debug.xcconfig"; sourceTree = "<group>"; };
8872
5CA996F7285A98FB00FF5D79 /* RegisterViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterViewModel.swift; sourceTree = "<group>"; };
73+
63095FFEF659AB2D2D5B8CDB /* Pods_AnimalsApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8974
7B390F83513FC642B7BEDAF0 /* Pods-AnimalsAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsAppTests.release.xcconfig"; path = "Target Support Files/Pods-AnimalsAppTests/Pods-AnimalsAppTests.release.xcconfig"; sourceTree = "<group>"; };
9075
7B6C2810AB19D2F9FE7AD5CF /* Pods-AnimalsApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsApp.release.xcconfig"; path = "Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp.release.xcconfig"; sourceTree = "<group>"; };
9176
81C9DABDE310C2E15910D06C /* Pods-AnimalsAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AnimalsAppTests.debug.xcconfig"; path = "Target Support Files/Pods-AnimalsAppTests/Pods-AnimalsAppTests.debug.xcconfig"; sourceTree = "<group>"; };
92-
9D1DC7AE05F709A3F0E450DA /* Pods_AnimalsApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
93-
A1E75A013A1B19FF9D2B114B /* Pods_AnimalsApp_AnimalsAppUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsApp_AnimalsAppUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
77+
9E32E9AF5724341E6FA29909 /* Pods_AnimalsAppTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsAppTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9478
A458A085285E58CC0057BC34 /* FavoritesViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewModel.swift; sourceTree = "<group>"; };
9579
A458A08B2860BD2D0057BC34 /* Alert+UIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Alert+UIViewController.swift"; sourceTree = "<group>"; };
9680
A458A0912860F7C40057BC34 /* success.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = success.json; sourceTree = "<group>"; };
@@ -130,30 +114,31 @@
130114
A463D082285D1D4500929A3C /* HomeViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModelTests.swift; sourceTree = "<group>"; };
131115
A463D084285D1F8800929A3C /* RegisterViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterViewModelTests.swift; sourceTree = "<group>"; };
132116
A463D089285D273400929A3C /* StringExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringExtensionTests.swift; sourceTree = "<group>"; };
117+
E781F8CAEBD95B309C5ED221 /* Pods_AnimalsApp_AnimalsAppUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AnimalsApp_AnimalsAppUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
133118
/* End PBXFileReference section */
134119

135120
/* Begin PBXFrameworksBuildPhase section */
136121
A463D0102858EBBB00929A3C /* Frameworks */ = {
137122
isa = PBXFrameworksBuildPhase;
138123
buildActionMask = 2147483647;
139124
files = (
140-
A458A0A0286351670057BC34 /* Pods_AnimalsApp.framework in Frameworks */,
125+
7190DF5ECD0BD55D0EC34B92 /* Pods_AnimalsApp.framework in Frameworks */,
141126
);
142127
runOnlyForDeploymentPostprocessing = 0;
143128
};
144129
A463D0292858EBBD00929A3C /* Frameworks */ = {
145130
isa = PBXFrameworksBuildPhase;
146131
buildActionMask = 2147483647;
147132
files = (
148-
A2A6AE83CC0E1DAC784999B1 /* Pods_AnimalsAppTests.framework in Frameworks */,
133+
7E7F56C054B69DA598C658E9 /* Pods_AnimalsAppTests.framework in Frameworks */,
149134
);
150135
runOnlyForDeploymentPostprocessing = 0;
151136
};
152137
A463D0332858EBBD00929A3C /* Frameworks */ = {
153138
isa = PBXFrameworksBuildPhase;
154139
buildActionMask = 2147483647;
155140
files = (
156-
56CADB59A535B3ED60380013 /* Pods_AnimalsApp_AnimalsAppUITests.framework in Frameworks */,
141+
194684F53D675326201633D5 /* Pods_AnimalsApp_AnimalsAppUITests.framework in Frameworks */,
157142
);
158143
runOnlyForDeploymentPostprocessing = 0;
159144
};
@@ -400,9 +385,9 @@
400385
A9C6C33CA0A11D6B033AAEA1 /* Frameworks */ = {
401386
isa = PBXGroup;
402387
children = (
403-
9D1DC7AE05F709A3F0E450DA /* Pods_AnimalsApp.framework */,
404-
A1E75A013A1B19FF9D2B114B /* Pods_AnimalsApp_AnimalsAppUITests.framework */,
405-
290D574622CE042567539136 /* Pods_AnimalsAppTests.framework */,
388+
63095FFEF659AB2D2D5B8CDB /* Pods_AnimalsApp.framework */,
389+
E781F8CAEBD95B309C5ED221 /* Pods_AnimalsApp_AnimalsAppUITests.framework */,
390+
9E32E9AF5724341E6FA29909 /* Pods_AnimalsAppTests.framework */,
406391
);
407392
name = Frameworks;
408393
sourceTree = "<group>";
@@ -418,8 +403,7 @@
418403
A463D00F2858EBBB00929A3C /* Sources */,
419404
A463D0102858EBBB00929A3C /* Frameworks */,
420405
A463D0112858EBBB00929A3C /* Resources */,
421-
E3DA1FD4397577CB97B30CF8 /* [CP] Embed Pods Frameworks */,
422-
A458A0A2286351670057BC34 /* Embed Frameworks */,
406+
6E4794EEB53E6E4FAB846AFF /* [CP] Embed Pods Frameworks */,
423407
);
424408
buildRules = (
425409
);
@@ -457,7 +441,7 @@
457441
A463D0322858EBBD00929A3C /* Sources */,
458442
A463D0332858EBBD00929A3C /* Frameworks */,
459443
A463D0342858EBBD00929A3C /* Resources */,
460-
75C6417FA6C107F8B9E07FF4 /* [CP] Embed Pods Frameworks */,
444+
F61FC844B40F52023186634D /* [CP] Embed Pods Frameworks */,
461445
);
462446
buildRules = (
463447
);
@@ -570,21 +554,21 @@
570554
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
571555
showEnvVarsInLog = 0;
572556
};
573-
75C6417FA6C107F8B9E07FF4 /* [CP] Embed Pods Frameworks */ = {
557+
6E4794EEB53E6E4FAB846AFF /* [CP] Embed Pods Frameworks */ = {
574558
isa = PBXShellScriptBuildPhase;
575559
buildActionMask = 2147483647;
576560
files = (
577561
);
578562
inputFileListPaths = (
579-
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
563+
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
580564
);
581565
name = "[CP] Embed Pods Frameworks";
582566
outputFileListPaths = (
583-
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
567+
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
584568
);
585569
runOnlyForDeploymentPostprocessing = 0;
586570
shellPath = /bin/sh;
587-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks.sh\"\n";
571+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks.sh\"\n";
588572
showEnvVarsInLog = 0;
589573
};
590574
ACA39DAD633345C6DA44DFAB /* [CP] Check Pods Manifest.lock */ = {
@@ -631,21 +615,21 @@
631615
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
632616
showEnvVarsInLog = 0;
633617
};
634-
E3DA1FD4397577CB97B30CF8 /* [CP] Embed Pods Frameworks */ = {
618+
F61FC844B40F52023186634D /* [CP] Embed Pods Frameworks */ = {
635619
isa = PBXShellScriptBuildPhase;
636620
buildActionMask = 2147483647;
637621
files = (
638622
);
639623
inputFileListPaths = (
640-
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
624+
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks-${CONFIGURATION}-input-files.xcfilelist",
641625
);
642626
name = "[CP] Embed Pods Frameworks";
643627
outputFileListPaths = (
644-
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
628+
"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks-${CONFIGURATION}-output-files.xcfilelist",
645629
);
646630
runOnlyForDeploymentPostprocessing = 0;
647631
shellPath = /bin/sh;
648-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp/Pods-AnimalsApp-frameworks.sh\"\n";
632+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AnimalsApp-AnimalsAppUITests/Pods-AnimalsApp-AnimalsAppUITests-frameworks.sh\"\n";
649633
showEnvVarsInLog = 0;
650634
};
651635
/* End PBXShellScriptBuildPhase section */
@@ -865,6 +849,7 @@
865849
SWIFT_EMIT_LOC_STRINGS = YES;
866850
SWIFT_VERSION = 5.0;
867851
TARGETED_DEVICE_FAMILY = "1,2";
852+
VALIDATE_WORKSPACE = YES;
868853
};
869854
name = Debug;
870855
};
@@ -895,6 +880,7 @@
895880
SWIFT_EMIT_LOC_STRINGS = YES;
896881
SWIFT_VERSION = 5.0;
897882
TARGETED_DEVICE_FAMILY = "1,2";
883+
VALIDATE_WORKSPACE = YES;
898884
};
899885
name = Release;
900886
};

AnimalsApp/AnimalsApp/View Models/FavoritesViewModel.swift

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,28 @@
88
import Foundation
99

1010
class FavoritesViewModel {
11+
//MARK: Properties
1112
let coreData: CoreDataContract
1213

1314
var favoriteAnimals = [Animal]()
1415
private var newCoreDataChanges = true
1516

17+
//MARK: Initialization
1618
init(coreData: CoreDataContract = CoreData.shared) {
1719
self.coreData = coreData
1820
coreData.delegate.append(self)
1921
}
2022

23+
//MARK: Methods
24+
func numberOfRows() -> Int {
25+
return favoriteAnimals.count
26+
}
27+
28+
func modelAt(_ index: Int) -> Animal {
29+
return favoriteAnimals[index]
30+
}
31+
32+
//MARK: Core Data Methods
2133
func getFavoriteAnimals(completion: @escaping () -> Void) {
2234
guard newCoreDataChanges else { return }
2335

@@ -29,14 +41,6 @@ class FavoritesViewModel {
2941
completion()
3042
}
3143

32-
func numberOfRows() -> Int {
33-
return favoriteAnimals.count
34-
}
35-
36-
func modelAt(_ index: Int) -> Animal {
37-
return favoriteAnimals[index]
38-
}
39-
4044
func removeFavorite(at index: Int, completion: @escaping () -> Void) {
4145
guard let id = favoriteAnimals[index].id else { return }
4246
favoriteAnimals.remove(at: index)
@@ -45,6 +49,7 @@ class FavoritesViewModel {
4549
}
4650
}
4751

52+
//MARK: Update Delegate Protocol
4853
extension FavoritesViewModel: UpdateDelegateProtocol {
4954
func updateFavoriteAnimals() {
5055
newCoreDataChanges = true

AnimalsApp/AnimalsApp/View Models/HomeViewModel.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@
88
import Foundation
99

1010
class HomeViewModel {
11+
//MARK: Properties
1112
private var webServices: WebServicesContract
1213
private var coreData: CoreDataContract
1314
var animals = [Animal]()
1415

16+
//MARK: Initialization
1517
init(webServices: WebServicesContract = WebServices(), coreData: CoreDataContract = CoreData.shared) {
1618
self.webServices = webServices
1719
self.coreData = coreData
1820
coreData.delegate.append(self)
1921
}
2022

23+
//MARK: Methods
2124
func numberOfRows() -> Int {
2225
return animals.count
2326
}
@@ -80,6 +83,7 @@ class HomeViewModel {
8083
}
8184
}
8285

86+
//MARK: Update Delegate Protocol
8387
extension HomeViewModel: UpdateDelegateProtocol {
8488
func updateFavoriteAnimals() {
8589
setFavorite()

AnimalsApp/AnimalsApp/View Models/RegisterViewModel.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
import Foundation
99

1010
struct RegisterViewModel {
11+
//MARK: Properties
1112
private var webServices: WebServicesContract
1213

14+
//MARK: Initialization
1315
init(webServices: WebServicesContract = WebServices()) {
1416
self.webServices = webServices
1517
}
1618

19+
//MARK: Methods
1720
func registerAnimal(name: String, description: String, age: Int, species: String, image: String, completion: @escaping ((Result<Void, Error>) -> Void)) {
1821

1922
let newAnimal = Animal(name: name, description: description, age: age, species: species, image: image)

AnimalsApp/AnimalsApp/Views/Components/AnimalTableViewCell.swift

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,19 @@ protocol ActionDelegateProtocol: AnyObject {
1414
}
1515

1616
class AnimalTableViewCell: UITableViewCell {
17+
18+
// MARK: Properties
1719
weak var delegate: ActionDelegateProtocol?
1820
var animal: Animal?
1921
var index: Int?
2022

23+
// MARK: Outlets
2124
@IBOutlet weak var animalImage: UIImageView!
2225
@IBOutlet weak var nameLabel: UILabel!
2326
@IBOutlet weak var descriptionLabel: UILabel!
2427
@IBOutlet weak var favoriteButton: UIButton!
2528

26-
override func awakeFromNib() {
27-
super.awakeFromNib()
28-
// Initialization code
29-
}
30-
31-
override func setSelected(_ selected: Bool, animated: Bool) {
32-
super.setSelected(selected, animated: animated)
33-
34-
// Configure the view for the selected state
35-
}
36-
29+
// MARK: Methods
3730
func configure() {
3831
guard let animal = animal else { return }
3932

@@ -57,6 +50,7 @@ class AnimalTableViewCell: UITableViewCell {
5750
animal.isFavorite ?? false ? favoriteButton.setImage(.favorite, for: .normal) : favoriteButton.setImage(.notFavorite, for: .normal)
5851
}
5952

53+
// MARK: Actions
6054
@IBAction func favoritePressed(_ sender: UIButton) {
6155
guard let animal = animal, let index = index else { return }
6256

AnimalsApp/AnimalsApp/Views/DetailViewController/DetailViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class DetailViewController: UIViewController {
2525
setupDetails()
2626
}
2727

28+
// MARK: Methods
2829
private func setupDetails() {
2930
guard let animal = animal else { return }
3031

0 commit comments

Comments
 (0)