Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
98C8A4E327C819DE00A630ED /* Contact.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C8A4E227C819DE00A630ED /* Contact.swift */; };
98C8A4E527C81A3F00A630ED /* TransferResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C8A4E427C81A3F00A630ED /* TransferResult.swift */; };
98C8A4E727C81A9C00A630ED /* UserProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98C8A4E627C81A9C00A630ED /* UserProfile.swift */; };
FBECEFF22943E4E40027C8A2 /* ContactListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBECEFF12943E4E40027C8A2 /* ContactListModel.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -117,6 +118,7 @@
98C8A4E227C819DE00A630ED /* Contact.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Contact.swift; sourceTree = "<group>"; };
98C8A4E427C81A3F00A630ED /* TransferResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransferResult.swift; sourceTree = "<group>"; };
98C8A4E627C81A9C00A630ED /* UserProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfile.swift; sourceTree = "<group>"; };
FBECEFF12943E4E40027C8A2 /* ContactListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactListModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -308,6 +310,7 @@
children = (
98584B19277E60740028DBEA /* ContactListView.swift */,
98584B1A277E60740028DBEA /* ContactListViewController.swift */,
FBECEFF12943E4E40027C8A2 /* ContactListModel.swift */,
);
path = ContactList;
sourceTree = "<group>";
Expand Down Expand Up @@ -499,6 +502,7 @@
98906BF229392248001D1975 /* ActivityListView.swift in Sources */,
98584AED277E50430028DBEA /* UserProfileView.swift in Sources */,
98C8A4E127C8196100A630ED /* ActivityDetails.swift in Sources */,
FBECEFF22943E4E40027C8A2 /* ContactListModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
guard let windowScene = (scene as? UIWindowScene) else { return }

self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = UINavigationController(rootViewController: HomeViewController())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[QUESTION]
Opa @kleitonm, não deveriamos manter o HomeViewController ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Foi mal, eu esqueci que não era pra subir, eu tinha substituído para testar a minha tela

self.window?.rootViewController = UINavigationController(rootViewController: ContactListViewController())
self.window?.windowScene = windowScene
self.window?.makeKeyAndVisible()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img3.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img4.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img5.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img6.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "img7.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,9 @@ import UIKit

class ContactCellView {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lembra de herdar da BaseView

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eliminar vestígios semânticos


private lazy var contactListView: ContactListView = {
let contactListView = ContactListView()
return contactListView
}()

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// ContactListModel.swift
// FinanceApp
//
// Created by Kleiton Mendes on 09/12/22.
//

import Foundation

struct ContactListModel {
let name: String
let phone: String
let image: String?
}



Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[QUESTION]
@kleitonm opa, acha que poderiamos remover esses espaçamentos ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eu ainda estou mexendo na tela, eu só abri o PR para irem acompanhando. Eu parei para fazer a BaseView pro ViewCode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boaaa, desculpe @kleitonm, não sabiaa uahauhu
Obrigado por avisar!

let contactList: [ContactListModel] = [
ContactListModel(name: "Ronald Robertson", phone: "+55 (11) 99999-9999", image: "img"),
ContactListModel(name: "Johnny Watson", phone: "+55 (11) 99999-9999", image: "img2"),
ContactListModel(name: "Annette Cooper", phone: "+55 (11) 99999-9999", image: "img3"),
ContactListModel(name: "Arthur Bell", phone: "+55 (11) 99999-9999", image: "img4"),
ContactListModel(name: "Jane Warren", phone: "+55 (11) 99999-9999", image: "img5"),
ContactListModel(name: "JMorris Henry", phone: "+55 (11) 99999-9999", image: "img6"),
ContactListModel(name: "Irma Flores", phone: "+55 (11) 99999-9999", image: "img7"),
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,82 @@
import UIKit

class ContactListView: UIView {

// private lazy var titleLabel: UILabel = {
// let label = UILabel()
// label.translatesAutoresizingMaskIntoConstraints = false
// label.numberOfLines = 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[QUESTION]
Irá utilizar esse código no futuro ? Caso não, acho legal apagar ☺️

// label.textColor = .black
// label.font = .boldSystemFont(ofSize: 20)
// label.textAlignment = .left
// label.text = "Contact List"
// label.backgroundColor = .gray
// return label
// }()

private let imagePerson: UIImageView = {
let image = UIImageView(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
image.translatesAutoresizingMaskIntoConstraints = false
image.layer.cornerRadius = 10
image.clipsToBounds = true
image.layer.masksToBounds = true
image.backgroundColor = .gray
image.contentMode = .scaleToFill
return image
}()

private lazy var nameLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.numberOfLines = 0
label.textColor = .black
label.font = .boldSystemFont(ofSize: 15)
label.textAlignment = .left
label.text = "Ronald Robertson"
return label
}()

private lazy var phoneLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.numberOfLines = 0
label.textColor = .gray
label.font = .boldSystemFont(ofSize: 13)
label.textAlignment = .left
label.text = "+55 (11)99999-9999"
return label
}()

private lazy var stackView: UIStackView = {
let stackView = UIStackView()
stackView.translatesAutoresizingMaskIntoConstraints = false
return stackView
}()

private func confighierarchy() {
// addSubview(titleLabel)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opa, o mesmo ponto acima, caso não for utilizar, acho legal apagar

addSubview(imagePerson)
stackView.addArrangedSubview(nameLabel)
stackView.addArrangedSubview(phoneLabel)
}


private func configConstraints() {
NSLayoutConstraint.activate([

// titleLabel.topAnchor.constraint(equalTo: self.safeAreaLayoutGuide.topAnchor, constant: 32.0),
// titleLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aqui também hehe 😄

// titleLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor),

imagePerson.leadingAnchor.constraint(equalTo: self.leadingAnchor, constant: 10.0),
imagePerson.trailingAnchor.constraint(equalTo: stackView.trailingAnchor, constant: -10),


stackView.topAnchor.constraint(equalTo: topAnchor, constant: 16.0),
stackView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: -16.0),
stackView.leadingAnchor.constraint(equalTo: imagePerson.leadingAnchor, constant: 24.0),
stackView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: -24.0),
])
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,68 @@ class ContactListViewController: UIViewController {

override func loadView() {
self.view = ContactListView()

confighierarchy()
configConstraints()
}


private lazy var contactCellView: ContactCellView = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[QUESTION]
Esses componentes de UI não deveria estar em um componente de UIView ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valeu pelas dicas, eu vou os ajustes, ainda faltam algumas coisas

let contactCellView = ContactCellView()
return contactCellView
}()

private lazy var titleLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.numberOfLines = 0
label.textColor = .black
label.font = .boldSystemFont(ofSize: 20)
label.textAlignment = .left
label.text = "Contact List"
label.backgroundColor = .gray
return label
}()

private lazy var contactTableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .plain)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .clear
tableView.register(ContactCellView.self, forCellReuseIdentifier: "cell")
tableView.separatorStyle = .none
return tableView
}()


private func confighierarchy() {
view.addSubview(titleLabel)
view.addSubview(contactTableView)
}


private func configConstraints() {
NSLayoutConstraint.activate([

titleLabel.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
titleLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),

contactTableView.topAnchor.constraint(equalTo: titleLabel.topAnchor),
contactTableView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
contactTableView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
contactTableView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
}

extension ContactListViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as UITableViewCell
cell.textLabel?.text = contactList[indexPath.row].name
return cell
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return contactList.count
}
}