Skip to content

Commit 0289468

Browse files
authored
Merge pull request #4 from lauramarson/webServices
Detail View Controller
2 parents cdeb477 + 25d64e7 commit 0289468

6 files changed

Lines changed: 106 additions & 4 deletions

File tree

AnimalsApp/AnimalsApp.xcodeproj/project.pbxproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
A463D06228590D0300929A3C /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D06128590D0300929A3C /* Images.swift */; };
2929
A463D065285953F900929A3C /* AnimalTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D063285953F900929A3C /* AnimalTableViewCell.swift */; };
3030
A463D066285953F900929A3C /* AnimalTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A463D064285953F900929A3C /* AnimalTableViewCell.xib */; };
31+
A463D069285A1A5A00929A3C /* WebServices.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D068285A1A5A00929A3C /* WebServices.swift */; };
32+
A463D06D285A22D200929A3C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D06B285A22D200929A3C /* DetailViewController.swift */; };
33+
A463D06E285A22D300929A3C /* DetailViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A463D06C285A22D200929A3C /* DetailViewController.xib */; };
3134
/* End PBXBuildFile section */
3235

3336
/* Begin PBXContainerItemProxy section */
@@ -79,6 +82,9 @@
7982
A463D06128590D0300929A3C /* Images.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; };
8083
A463D063285953F900929A3C /* AnimalTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalTableViewCell.swift; sourceTree = "<group>"; };
8184
A463D064285953F900929A3C /* AnimalTableViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AnimalTableViewCell.xib; sourceTree = "<group>"; };
85+
A463D068285A1A5A00929A3C /* WebServices.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebServices.swift; sourceTree = "<group>"; };
86+
A463D06B285A22D200929A3C /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
87+
A463D06C285A22D200929A3C /* DetailViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DetailViewController.xib; sourceTree = "<group>"; };
8288
/* End PBXFileReference section */
8389

8490
/* Begin PBXFrameworksBuildPhase section */
@@ -147,6 +153,7 @@
147153
A463D0152858EBBB00929A3C /* AnimalsApp */ = {
148154
isa = PBXGroup;
149155
children = (
156+
A463D067285A1A4300929A3C /* Services */,
150157
A463D06028590CB700929A3C /* DesignSystem */,
151158
A463D05F2858F66B00929A3C /* Views */,
152159
A463D0162858EBBB00929A3C /* AppDelegate.swift */,
@@ -216,6 +223,7 @@
216223
A463D05F2858F66B00929A3C /* Views */ = {
217224
isa = PBXGroup;
218225
children = (
226+
A463D06A285A22AF00929A3C /* DetailViewController */,
219227
A463D0502858F4DE00929A3C /* FavoritesViewController */,
220228
A463D04F2858F49600929A3C /* RegisterViewController */,
221229
A463D04E2858F47C00929A3C /* HomeViewController */,
@@ -232,6 +240,23 @@
232240
path = DesignSystem;
233241
sourceTree = "<group>";
234242
};
243+
A463D067285A1A4300929A3C /* Services */ = {
244+
isa = PBXGroup;
245+
children = (
246+
A463D068285A1A5A00929A3C /* WebServices.swift */,
247+
);
248+
path = Services;
249+
sourceTree = "<group>";
250+
};
251+
A463D06A285A22AF00929A3C /* DetailViewController */ = {
252+
isa = PBXGroup;
253+
children = (
254+
A463D06B285A22D200929A3C /* DetailViewController.swift */,
255+
A463D06C285A22D200929A3C /* DetailViewController.xib */,
256+
);
257+
path = DetailViewController;
258+
sourceTree = "<group>";
259+
};
235260
A9C6C33CA0A11D6B033AAEA1 /* Frameworks */ = {
236261
isa = PBXGroup;
237262
children = (
@@ -354,6 +379,7 @@
354379
A463D04C2858F39000929A3C /* MainTabBarController.xib in Resources */,
355380
A463D0582858F62600929A3C /* RegisterViewController.xib in Resources */,
356381
A463D066285953F900929A3C /* AnimalTableViewCell.xib in Resources */,
382+
A463D06E285A22D300929A3C /* DetailViewController.xib in Resources */,
357383
A463D0262858EBBD00929A3C /* LaunchScreen.storyboard in Resources */,
358384
A463D0232858EBBD00929A3C /* Assets.xcassets in Resources */,
359385
A463D05E2858F64B00929A3C /* FavoritesViewController.xib in Resources */,
@@ -492,6 +518,8 @@
492518
A463D0172858EBBB00929A3C /* AppDelegate.swift in Sources */,
493519
A463D04B2858F39000929A3C /* MainTabBarController.swift in Sources */,
494520
A463D05D2858F64B00929A3C /* FavoritesViewController.swift in Sources */,
521+
A463D06D285A22D200929A3C /* DetailViewController.swift in Sources */,
522+
A463D069285A1A5A00929A3C /* WebServices.swift in Sources */,
495523
A463D0532858F60C00929A3C /* HomeViewController.swift in Sources */,
496524
);
497525
runOnlyForDeploymentPostprocessing = 0;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//
2+
// WebServices.swift
3+
// AnimalsApp
4+
//
5+
// Created by Laura Pinheiro Marson on 15/06/22.
6+
//
7+
8+
import Foundation
9+
import Alamofire
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//
2+
// DetailViewController.swift
3+
// AnimalsApp
4+
//
5+
// Created by Laura Pinheiro Marson on 15/06/22.
6+
//
7+
8+
import UIKit
9+
10+
class DetailViewController: UIViewController {
11+
12+
override func viewDidLoad() {
13+
super.viewDidLoad()
14+
15+
}
16+
17+
func setupNavBar() {
18+
let appearance = UINavigationBarAppearance()
19+
appearance.configureWithOpaqueBackground()
20+
navigationController?.navigationBar.standardAppearance = appearance
21+
navigationController?.navigationBar.scrollEdgeAppearance = navigationController?.navigationBar.standardAppearance
22+
}
23+
24+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3+
<device id="retina6_1" orientation="portrait" appearance="light"/>
4+
<dependencies>
5+
<deployment identifier="iOS"/>
6+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
7+
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
8+
<capability name="System colors in document resources" minToolsVersion="11.0"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<objects>
12+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="DetailViewController" customModule="AnimalsApp" customModuleProvider="target">
13+
<connections>
14+
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
15+
</connections>
16+
</placeholder>
17+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
18+
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
19+
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
20+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
21+
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
22+
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
23+
<point key="canvasLocation" x="132" y="51"/>
24+
</view>
25+
</objects>
26+
<resources>
27+
<systemColor name="systemBackgroundColor">
28+
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
29+
</systemColor>
30+
</resources>
31+
</document>

AnimalsApp/AnimalsApp/Views/HomeViewController/AnimalTableViewCell.xib

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
<constraint firstAttribute="width" constant="50" id="kcM-BZ-81T"/>
2525
</constraints>
2626
</imageView>
27-
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="687-rn-Ydp">
27+
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="687-rn-Ydp">
2828
<rect key="frame" x="277" y="22.5" width="15" height="15"/>
2929
<constraints>
3030
<constraint firstAttribute="height" constant="15" id="7rZ-bg-lFP"/>
3131
<constraint firstAttribute="width" constant="15" id="i65-df-ED5"/>
3232
</constraints>
33-
<state key="normal" title="Button"/>
34-
<buttonConfiguration key="configuration" style="plain" image="addFavorite"/>
33+
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
34+
<state key="normal" image="addFavorite"/>
3535
</button>
3636
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="fsl-xq-9yj">
3737
<rect key="frame" x="70" y="11" width="57" height="38.5"/>

AnimalsApp/AnimalsApp/Views/HomeViewController/HomeViewController.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ extension HomeViewController: UITableViewDataSource {
2727
}
2828

2929
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
30-
guard let cell = tableView.dequeueReusableCell(withIdentifier: "Animal") as? AnimalTableViewCell else {
30+
guard let cell = tableView.dequeueReusableCell(withIdentifier: "Animal", for: indexPath) as? AnimalTableViewCell else {
3131
return UITableViewCell()
3232
}
3333

@@ -38,4 +38,14 @@ extension HomeViewController: UITableViewDataSource {
3838

3939
extension HomeViewController: UITableViewDelegate {
4040

41+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
42+
print("entrou")
43+
let detailVC = DetailViewController(nibName: "DetailViewController", bundle: nil)
44+
45+
// let book = booksCollectionVM.modelAt(indexPath.row)
46+
// dvc.detailVM = DetailBookViewModel(book: book)
47+
48+
navigationController?.pushViewController(detailVC, animated: true)
49+
}
50+
4151
}

0 commit comments

Comments
 (0)