Skip to content

Commit

Permalink
Refactor: Section 2.3. update
Browse files Browse the repository at this point in the history
### Motivation
- Section 2.3. Customize the Row Preview

### Key Changes
- Section 2.3. Customize the Row Preview 예제 코드 및 주석 추가

### To Reviewers
- 없음
  • Loading branch information
garlicvread committed Aug 11, 2022
1 parent 12a90ae commit e785d93
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tutorial/Views/LandmarkRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ struct LandmarkRow: View {

struct LandmarkRow_Previews: PreviewProvider {
static var previews: some View {
LandmarkRow(landmark: landmarks[0]) // 2.2.4. LandmarkRow 구조체 내에 정의된 parameter 추가 -> landmarks 배열의 요소 특정
Group { // 2.3.4. 코드를 간단히 줄이려면 group으로 Preview를 묶은 방법도 있음
LandmarkRow(landmark: landmarks[0])
LandmarkRow(landmark: landmarks[1])
}
// LandmarkRow(landmark: landmarks[0]) // 2.2.4. LandmarkRow 구조체 내에 정의된 parameter 추가 -> landmarks 배열의 요소 특정
// .previewLayout(.fixed(width: 300, height: 70)) // 2.3.2. .previewLayout 메서드를 사용하면 static preview의 사이즈를 조절할 수 있음
//
// LandmarkRow(landmark: landmarks[1]) // 2.3.3. preview를 여러 개 추가할 수 있다
.previewLayout(.fixed(width: 300, height: 70))
}
}

0 comments on commit e785d93

Please sign in to comment.