Skip to content

Commit

Permalink
Document refresh control height.
Browse files Browse the repository at this point in the history
  • Loading branch information
svara committed May 19, 2023
1 parent a9c19d7 commit 264ba08
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Source/Visitable/VisitableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,14 @@ open class VisitableView: UIView {
#if !targetEnvironment(macCatalyst)
scrollView.addSubview(refreshControl)

let height = refreshControl.frame.height > 0 ? refreshControl.frame.height : 60
/// Infer refresh control's default height from its frame, if given.
/// Otherwise fallback to 60 (the default height).
let refreshControlHeight = refreshControl.frame.height > 0 ? refreshControl.frame.height : 60

NSLayoutConstraint.activate([
refreshControl.centerXAnchor.constraint(equalTo: centerXAnchor),
refreshControl.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor),
refreshControl.heightAnchor.constraint(equalToConstant: height)
refreshControl.heightAnchor.constraint(equalToConstant: refreshControlHeight)
])
#endif
}
Expand Down

0 comments on commit 264ba08

Please sign in to comment.