Skip to content
Merged
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
4 changes: 2 additions & 2 deletions DevLog/UI/Home/TodoListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ struct TodoListView: View {
GeometryReader { geometry in
Color.clear
.onAppear {
headerHeight = geometry.size.height + 1
headerHeight = geometry.size.height.rounded()
}
.onChange(of: geometry.size.height) { _, height in
headerHeight = height + 1
headerHeight = height.rounded()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

iOS 17부터 onChange 수정자에 initial 파라미터가 추가되어 onAppearonChange를 하나로 합칠 수 있습니다. 코드를 더 간결하게 만들 수 있으니 적용해보시는 것을 추천합니다.

Suggested change
.onAppear {
headerHeight = geometry.size.height + 1
headerHeight = geometry.size.height.rounded()
}
.onChange(of: geometry.size.height) { _, height in
headerHeight = height + 1
headerHeight = height.rounded()
}
.onChange(of: geometry.size.height, initial: true) { _, height in
headerHeight = height.rounded()
}

}
}
Expand Down