๋ชจ๋ฐ๋ชจ๋ฐ iOS ๐
-
Template
### Related Issue resolve: # ### What does this PR do? - ### Why are we doing this? - ### Screenshots
-
Merge Option
- ํด์ปคํค : 1๋ช ์ด์์ ์ฝ๋๋ฆฌ๋ทฐ
- ์ดํ : 2๋ช ์ด์์ ์ฝ๋๋ฆฌ๋ทฐ
MVVM
-
๋๋ ํ ๋ฆฌ ๊ตฌ์ฑ
- ํ๋ฉด ํ๋๋น ํฐ ํด๋๋ฅผ ๊ฐ๋๋ค.
- ํฐ ํด๋ ๋ด์๋ cell ํด๋, ViewController ํ์ผ, ViewModel ํ์ผ์ ๊ฐ๋๋ค.
-
MARK ์ฃผ์ ์์
// MARK: - describe
- UIComponents
- Properties
- Initializer
- Lifecycle
- Actions
- Methods
- Protocols
-
/// ์ฃผ์ ํ์ฉ
- ๋ฉ์๋๋ฅผ ์ ์ธํ๋๋ฐ ์ค๋ช ์ด ๋ถ์กฑํ๋ค๊ณ ๋๋ผ๋ฉด,
- ์ ์ธ๋ถ ์์
/// ์ฃผ์
์ผ๋ก Summary์ ์ค๋ช ์ ์ถ๊ฐํ ์ ์๋ค. - ๋๋
command + ํจ์๋ช ํด๋ฆญ
ํด์ Add documentation์ผ๋ก ์ถ๊ฐํ ์ ์๋ค. - ๋์ค์ ํธ์ถ๋ถ์์
option + ํจ์๋ช ํด๋ฆญ
์ผ๋ก Summary ๋ด์ฉ ํ์ธํ ์ ์๋ค.
-
์ฝ๋๋ก ๋ ์ด์์ ์งค ๋ ์ฌ๋ฌ๊ฐ์ subview ์ถ๊ฐํ๋ ๋ฒ
[subview1, subview2, subview3].forEach { superview.addSubView($0) }
-
SnapKit
-
left, right ๋ณด๋ค๋
leading
,trailing
์ฌ์ฉ -
์ ์ฝ์กฐ๊ฑด ์ก๋ ์์ :
top
,leading
,trailing
,bottom
,width
,heigth
์ -! -
make
vs
remake
vs
update
makeConstraints
: ์ฒ์ ์ก์ ๋remakeConstraints
: ์กํ์๋ ์ ์ฝ์กฐ๊ฑด ์ด๊ธฐํํ๊ณ ๋ค์ ์ก์ ๋updateConstraints
: ๊ธฐ์กด์ ์ ์ฝ์กฐ๊ฑด ์ ์งํ ์ฑ, ์ผ๋ถ๋ง ์ ๋ฐ์ดํธํ ๋
-
makeConstraints ํด๋ก์ ์ make ๋๋ $0 ?? โ
make
๋ฅผ ์ฐ์
-
-
๋ทฐ ์ ์ธ ํ ๋ lazy var vs let
-
ํฐ ์ฐจ์ด๋ ์์ง๋ง.. ์ผ๋จ **
let
**์ผ๋ก ํต์ผํ์. -
let์ผ๋ก ์๋๋ ๊ฒฝ์ฐ๊ฐ ์๋ค. ๊ทธ๋ด ๋๋ง
**lazy var**
๋ฅผ ์ฌ์ฉํ์.
-
-
๋ทฐ ์ ์ธ๊ณผ ๋์์ ์ด๊ธฐํ (ํด๋ก์ ํ์ฉ)
let gameImageView: UIImageView = { let imageView: UIImageView = UIImageView(frame: .zero) imageView.contentMode = .scaleAspectFill imageView.layer.masksToBounds = true imageView.layer.cornerRadius = 9 imageView.layer.borderWidth = 1 imageView.layer.borderColor = UIColor.veryLightPinkTwo.cgColor return imageView }()
-
extension ํ์ฉ
- Zeplin์์๋ UIColor๋ฅผ extension ํ ์ฝ๋๋ฅผ ๋ด๋ณด๋ด๊ธฐ ํด์ค๋ค. โ ํผ๊ทธ๋ง๋ ์ด๋ป๊ฒ ๋์ค๋ ๋ด ์๋ค!
- label, button ๋ฑ, ์ด๊ธฐํํด์ค์ผ ํ ์์ฑ๋ค์ด ๋ง์๋ฐ, ์ด๋ฅผ ํ๊บผ๋ฒ์ ๋ฌถ์ด์ ์ด๊ธฐํํ ์ ์๋ ๋ฉ์๋๋ฅผ extension์ ๋ง๋ค์ด์ ๋ฃ์ด์ค ์ ์๋ค.