Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/settings view #50

Merged
merged 14 commits into from
Nov 24, 2022
Merged

Feature/settings view #50

merged 14 commits into from
Nov 24, 2022

Conversation

jinwoong16
Copy link
Collaborator

@jinwoong16 jinwoong16 commented Nov 23, 2022

๐Ÿ“• Issue Number

Close #49

๐Ÿ“™ ์ž‘์—… ๋‚ด์—ญ

๊ตฌํ˜„ ๋‚ด์šฉ ๋ฐ ์ž‘์—… ํ–ˆ๋˜ ๋‚ด์—ญ

  • ๋ฉ”์ธ์„ TableView๋กœ ๊ตฌ์„ฑ
  • ํ…์ŠคํŠธ๋งŒ ํ‘œ์‹œํ•ด์ฃผ๋Š” ํ•„๋“œ ์ถ”๊ฐ€
  • ํด๋ฆญ์‹œ, ํ™”๋ฉด์ด๋™์ด ๊ฐ€๋Šฅํ•œ ํ•„๋“œ ์ถ”๊ฐ€
  • ํ† ๊ธ€ ์Šค์œ„์น˜๋ฅผ ๊ฐ€์ง„ ํ•„๋“œ ์ถ”๊ฐ€

๐Ÿ“˜ ์ž‘์—… ์œ ํ˜•

  • ์‹ ๊ทœ ๊ธฐ๋Šฅ ์ถ”๊ฐ€
  • ๋ฒ„๊ทธ ์ˆ˜์ •
  • ๋ฆฌํŽ™ํ† ๋ง
  • ๋ฌธ์„œ ์—…๋ฐ์ดํŠธ

๐Ÿ“‹ ์ฒดํฌ๋ฆฌ์ŠคํŠธ

  • Merge ํ•˜๋Š” ๋ธŒ๋žœ์น˜๊ฐ€ ์˜ฌ๋ฐ”๋ฅธ๊ฐ€?
  • ์ฝ”๋”ฉ์ปจ๋ฒค์…˜์„ ์ค€์ˆ˜ํ•˜๋Š”๊ฐ€?
  • PR๊ณผ ๊ด€๋ จ์—†๋Š” ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์—†๋Š”๊ฐ€?
  • ๋‚ด ์ฝ”๋“œ์— ๋Œ€ํ•œ ์ž๊ธฐ ๊ฒ€ํ† ๊ฐ€ ๋˜์—ˆ๋Š”๊ฐ€?
  • ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ํšจ๊ณผ์ ์ด๊ฑฐ๋‚˜ ๋™์ž‘์ด ์ž‘๋™ํ•œ๋‹ค๋Š” ๊ฒƒ์„ ๋ณด์ฆํ•˜๋Š” ํ…Œ์ŠคํŠธ๋ฅผ ์ถ”๊ฐ€ํ•˜์˜€๋Š”๊ฐ€?
  • ์ƒˆ๋กœ์šด ํ…Œ์ŠคํŠธ์™€ ๊ธฐ์กด์˜ ํ…Œ์ŠคํŠธ๊ฐ€ ๋ณ€๊ฒฝ์‚ฌํ•ญ์— ๋Œ€ํ•ด ๋งŒ์กฑํ•˜๋Š”๊ฐ€?

๐Ÿ“ PR ํŠน์ด ์‚ฌํ•ญ

PR์„ ๋ณผ ๋•Œ ์ฃผ์˜๊นŠ๊ฒŒ ๋ด์•ผํ•˜๊ฑฐ๋‚˜ ๋งํ•˜๊ณ  ์‹ถ์€ ์ 

  • ํ˜„์žฌ๋Š” ViewController์— ์žˆ๋Š” fields ํ”„๋กœํผํ‹ฐ๋ฅผ ํ†ตํ•ด์„œ ๋ธ๋ฆฌ๊ฒŒ์ดํŠธ ๋ฉ”์„œ๋“œ๋ฅผ ์‹คํ–‰ํ•˜๋Š”๋ฐ, ๋‚˜์ค‘์— fields๋ถ€๋ถ„์„ ๋”ฐ๋กœ ViewModel ํŒŒํŠธ๋ฅผ ๋งŒ๋“ค์–ด์„œ ์ฒ˜๋ฆฌํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธ๊ณผ ๋กœ๊ทธ์•„์›ƒ์€ ์ƒํƒœ์— ๋”ฐ๋ผ ํ…์ŠคํŠธ๊ฐ€ ๋ณ€๊ฒฝ๋˜์–ด์•ผ ํ•˜๊ณ , ํ† ๊ธ€ ์—ญ์‹œ ๋ˆ„๋ฅผ๋•Œ๋งˆ๋‹ค ์ƒํƒœ๋ฅผ ๋ณ€๊ฒฝํ•ด์•ผํ• ํ…Œ๋‹ˆ๊นŒ์š”.
final class SettingsViewController: UITableViewController {
    
    private let fields: [CommonField]  = [
        ToggleField(viewModel: .init(title: "๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ", imageName: "person.crop.circle.badge.checkmark")),
        PlainField(viewModel: .init(title: "some", info: "some...?", imageName: "pencil")),
        NavigateField(viewModel: .init(title: "๋กœ๊ทธ์ธ", imageName: "person.circle.fill")),
        PlainField(viewModel: .init(title: "์•ฑ ๋ฒ„์ „", info: "0.0.1", imageName: "exclamationmark.transmission"))
    ]
    
    // MARK: - Life Cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.separatorStyle = .singleLine
        
        register()
    }
    
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return fields.count
    }
    
    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let field = fields[indexPath.row]
        return field.dequeue(for: tableView, at: indexPath)
    }
    
    private func register() {
        fields.forEach { field in
            field.register(for: self.tableView)
        }
    }
}



@jinwoong16 jinwoong16 linked an issue Nov 23, 2022 that may be closed by this pull request
2 tasks
Copy link
Collaborator

@wickedRun wickedRun left a comment

Choose a reason for hiding this comment

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

์˜ค์šฐ ๋š๋”ฑ๋š๋”ฑ ์•ผ๋ฌด์ง€์‹ญ๋‹ˆ๋‹ค. ๊ณ ์ƒํ•˜์…จ์๋‹ˆ๋‹ค.

didSet {
fields.forEach { field in
field.register(for: self.tableView)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

์Œ field๊ฐ€ ๋™์ ์œผ๋กœ ์ถ”๊ฐ€๋  ์ผ์ด ์žˆ๋‚˜์š”?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

viewdidload์—์„œ fields์— ์ดˆ๊ธฐ๊ฐ’์ด ๋“ค์–ด๊ฐ‘๋‹ˆ๋‹ค. ๋™์ ์œผ๋กœ ์ถ”๊ฐ€๋  ์ผ์€ ์—†์ง€๋งŒ, ํ”„๋กœํ”ผํ„ฐ ์˜ต์ €๋ฒ„๋กœ ์ฒ˜๋ฆฌํ•˜๋ฉด view did load ๋ฉ”์„œ๋“œ์—์„œ ๋”ฐ๋กœ ๋‹ค๋ฅธ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•  ํ•„์š”๊ฐ€ ์—†์–ด์ ธ์„œ ์ €๋ ‡๊ฒŒ ๊ตฌํ˜„ํ–ˆ์–ด์š” :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

์Œ ์ €๋Š” ๊ณ ์ •์ ์ธ ๊ฐ’์ด var๋กœ ์„ ์–ธ๋˜๋Š” ๊ฒƒ์ด ์ข€ ๊ทธ๋ ‡๊ธฐ๋„ ํ•˜๊ณ  ์ œ ์ƒ๊ฐ์œผ๋ก  ์•ฝ๊ฐ„ ์“ธ๋ชจ์—†๋Š” ํ•จ์ˆ˜๊ฐ€ ๋งŒ๋“ค์–ด์กŒ๋‹ค๊ณ ๋„ ์ƒ๊ฐ์„ ํ•ด์„œ viewDidLoad์—์„œ ํ•œ๋ฒˆ๋งŒ ํ˜ธ์ถœํ•ด์ฃผ๋Š”๊ฒŒ ์ข‹์„ ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹น

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ํ”ผ๋“œ๋ฐฑ ๋ฐ˜์˜ํ–ˆ์Šต๋‹ˆ๋‹ค! ์ด์ œ ์•„๋ž˜์˜ ๋ฉ”์„œ๋“œ๋ฅผ ํ˜ธ์ถœํ•ด์„œ ์ฒ˜๋ฆฌํ•˜๋Š” ์ฝ”๋“œ๋กœ ๋ฐ”๊ฟจ์Šต๋‹ˆ๋‹ค :)

private func register() {
        fields.forEach { field in
            field.register(for: self.tableView)
        }
}

@Jeonhui
Copy link
Member

Jeonhui commented Nov 23, 2022

๊ณ ์ƒ ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค! ํ˜น์‹œ Toggle๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ์…€ ๋‚ด๋ถ€์—์„œ ๋“ค๊ณ  ์žˆ๋Š”๋ฐ Settings View Controller์—์„œ ์–ด๋–ค ์‹์œผ๋กœ ์ฒ˜๋ฆฌํ•˜์‹ค ๊ฑด์ง€ ์—ฌ์ญค๋ด๋„ ๋ ๊นŒ์š”?

- `fields`์„ private let์œผ๋กœ ๋ณ€๊ฒฝ, `register`๋ฅผ ํ•ด์ฃผ๋Š” private ๋ฉ”์„œ๋“œ ์ถ”๊ฐ€
@jinwoong16
Copy link
Collaborator Author

๊ณ ์ƒ ๋งŽ์œผ์…จ์Šต๋‹ˆ๋‹ค! ํ˜น์‹œ Toggle๊ฐ™์€ ๊ฒฝ์šฐ๋Š” ์…€ ๋‚ด๋ถ€์—์„œ ๋“ค๊ณ  ์žˆ๋Š”๋ฐ Settings View Controller์—์„œ ์–ด๋–ค ์‹์œผ๋กœ ์ฒ˜๋ฆฌํ•˜์‹ค ๊ฑด์ง€ ์—ฌ์ญค๋ด๋„ ๋ ๊นŒ์š”?

์ง€๊ธˆ์€ ๊ตฌ์กฐ์ฒด๋กœ ๋˜์–ด์žˆ๋Š” ToggleItemViewModel์„ ํ†ตํ•ด์„œ ์ฒ˜๋ฆฌํ•  ์ƒ๊ฐ์ž…๋‹ˆ๋‹ค. ๊ทธ๋•Œ๊ฐ€ ๋˜๋ฉด class๋กœ ๋ฐ”๊ฟ”์„œ ์ฒ˜๋ฆฌํ•ด์•ผํ•  ๊ฒƒ ๊ฐ™์•„์š”.
๋˜ํ•œ, ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ์˜ ์—ฌ๋ถ€๋ฅผ ์–ด๋””์— ์ €์žฅํ•˜๊ณ  ๋ถˆ๋Ÿฌ์˜ฌ์ง€๋ฅผ ๊ฒฐ์ •์„ ๋ชปํ•ด์„œ ์ง€๊ธˆ์˜ ์ƒํƒœ๊ฐ€ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค :)

@Jeonhui
Copy link
Member

Jeonhui commented Nov 23, 2022

ViewModel์„ ์ด์šฉํ•˜๋ฉด ์กฐ๊ธˆ๋” ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌํ•˜๊ธฐ๊ฐ€ ํŽธํ•ด์ง€๊ฒ ๋„ค์š”! ์ข‹์Šต๋‹ˆ๋‹ค!
์ €๋Š” ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ / ๊ฑฐ๋ถ€๋„ ์‚ฌ์šฉ์ž์˜ ์ •๋ณด๋กœ ๋ณผ ์ˆ˜ ์žˆ์„ ๊ฒƒ ๊ฐ™์•„์„œ ๋‘˜๋Ÿฌ๋ณด๊ธฐ ํ—ˆ์šฉ ์—ฌ๋ถ€๋„ UserInfo์— ๊ฐ™์ด ์ €์žฅ์„ ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์„ ๊ฒƒ ๊ฐ™๋‹ค๊ณ  ์ƒ๊ฐ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋‚ด์ผ ๋‹ค๋ฅธ ๋ถ„๋“ค ์˜๊ฒฌ๋„ ๋“ค์–ด๋ณด๋ฉด ์ข‹์„ ๊ฒƒ ๊ฐ™์•„์š”

@sprituz
Copy link
Member

sprituz commented Nov 24, 2022

๋ฒŒ์จ ์„ค์ •๋ทฐ๊ฐ€ ๊ตฌ์„ฑ์ด ๋์—ˆ๋„ค์š” ๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค!!

@jinwoong16 jinwoong16 merged commit 086db4d into develop Nov 24, 2022
@jinwoong16 jinwoong16 deleted the feature/SettingsView branch November 24, 2022 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Settings View
4 participants