-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#4] ContactDetailViewController MVVM 적용
- Loading branch information
Showing
8 changed files
with
208 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
CheoMooRac/CheoMooRac/Sources/ViewControllers/ContactDetailViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// ReadViewController.swift | ||
// CheoMooRac | ||
// | ||
// Created by 김윤서 on 2021/09/15. | ||
// | ||
|
||
import UIKit | ||
|
||
import Then | ||
import SnapKit | ||
|
||
class ContactDetailViewController: UIViewController { | ||
|
||
private var tableViewController: ContactDetailTableViewController! | ||
|
||
init(with viewModel: ContactDetailViewModel) { | ||
tableViewController = ContactDetailTableViewController(with: viewModel) | ||
super.init(nibName: nil, bundle: nil) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
initViewController() | ||
setLayout() | ||
} | ||
|
||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
navigationItem.largeTitleDisplayMode = .never | ||
} | ||
|
||
private func initViewController() { | ||
view.backgroundColor = .white | ||
} | ||
|
||
private func setLayout() { | ||
setViewHierarchy() | ||
setConstraints() | ||
} | ||
|
||
private func setViewHierarchy() { | ||
embed(tableViewController) | ||
view.addSubview(tableViewController.view) | ||
} | ||
|
||
private func setConstraints() { | ||
tableViewController.view.snp.makeConstraints { | ||
$0.edges.equalToSuperview() | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 0 additions & 105 deletions
105
CheoMooRac/CheoMooRac/Sources/ViewControllers/ReadViewController.swift
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
CheoMooRac/CheoMooRac/Sources/ViewModels/ContactDetailViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// ContactDetailViewModel.swift | ||
// CheoMooRac | ||
// | ||
// Created by 김윤서 on 2021/09/24. | ||
// | ||
|
||
import Foundation | ||
|
||
class ContactDetailViewModel { | ||
var items: [String] | ||
|
||
init(person: Person){ | ||
self.items = [person.familyName+person.firstName, person.phoneNumber] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.