Skip to content

Commit 25d64e7

Browse files
committed
add detail view controller
1 parent 8a13adb commit 25d64e7

5 files changed

Lines changed: 87 additions & 6 deletions

File tree

AnimalsApp/AnimalsApp.xcodeproj/project.pbxproj

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
A463D05D2858F64B00929A3C /* FavoritesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D05B2858F64B00929A3C /* FavoritesViewController.swift */; };
2727
A463D05E2858F64B00929A3C /* FavoritesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A463D05C2858F64B00929A3C /* FavoritesViewController.xib */; };
2828
A463D06228590D0300929A3C /* Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D06128590D0300929A3C /* Images.swift */; };
29-
A463D069285A1A5A00929A3C /* WebServices.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D068285A1A5A00929A3C /* WebServices.swift */; };
3029
A463D065285953F900929A3C /* AnimalTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A463D063285953F900929A3C /* AnimalTableViewCell.swift */; };
3130
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 */; };
3234
/* End PBXBuildFile section */
3335

3436
/* Begin PBXContainerItemProxy section */
@@ -78,9 +80,11 @@
7880
A463D05B2858F64B00929A3C /* FavoritesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoritesViewController.swift; sourceTree = "<group>"; };
7981
A463D05C2858F64B00929A3C /* FavoritesViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FavoritesViewController.xib; sourceTree = "<group>"; };
8082
A463D06128590D0300929A3C /* Images.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Images.swift; sourceTree = "<group>"; };
81-
A463D068285A1A5A00929A3C /* WebServices.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebServices.swift; sourceTree = "<group>"; };
8283
A463D063285953F900929A3C /* AnimalTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnimalTableViewCell.swift; sourceTree = "<group>"; };
8384
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>"; };
8488
/* End PBXFileReference section */
8589

8690
/* Begin PBXFrameworksBuildPhase section */
@@ -219,6 +223,7 @@
219223
A463D05F2858F66B00929A3C /* Views */ = {
220224
isa = PBXGroup;
221225
children = (
226+
A463D06A285A22AF00929A3C /* DetailViewController */,
222227
A463D0502858F4DE00929A3C /* FavoritesViewController */,
223228
A463D04F2858F49600929A3C /* RegisterViewController */,
224229
A463D04E2858F47C00929A3C /* HomeViewController */,
@@ -243,6 +248,15 @@
243248
path = Services;
244249
sourceTree = "<group>";
245250
};
251+
A463D06A285A22AF00929A3C /* DetailViewController */ = {
252+
isa = PBXGroup;
253+
children = (
254+
A463D06B285A22D200929A3C /* DetailViewController.swift */,
255+
A463D06C285A22D200929A3C /* DetailViewController.xib */,
256+
);
257+
path = DetailViewController;
258+
sourceTree = "<group>";
259+
};
246260
A9C6C33CA0A11D6B033AAEA1 /* Frameworks */ = {
247261
isa = PBXGroup;
248262
children = (
@@ -365,6 +379,7 @@
365379
A463D04C2858F39000929A3C /* MainTabBarController.xib in Resources */,
366380
A463D0582858F62600929A3C /* RegisterViewController.xib in Resources */,
367381
A463D066285953F900929A3C /* AnimalTableViewCell.xib in Resources */,
382+
A463D06E285A22D300929A3C /* DetailViewController.xib in Resources */,
368383
A463D0262858EBBD00929A3C /* LaunchScreen.storyboard in Resources */,
369384
A463D0232858EBBD00929A3C /* Assets.xcassets in Resources */,
370385
A463D05E2858F64B00929A3C /* FavoritesViewController.xib in Resources */,
@@ -503,6 +518,7 @@
503518
A463D0172858EBBB00929A3C /* AppDelegate.swift in Sources */,
504519
A463D04B2858F39000929A3C /* MainTabBarController.swift in Sources */,
505520
A463D05D2858F64B00929A3C /* FavoritesViewController.swift in Sources */,
521+
A463D06D285A22D200929A3C /* DetailViewController.swift in Sources */,
506522
A463D069285A1A5A00929A3C /* WebServices.swift in Sources */,
507523
A463D0532858F60C00929A3C /* HomeViewController.swift in Sources */,
508524
);
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)