Fix wrap content calculation by filter hidden views#280
Fix wrap content calculation by filter hidden views#280ruslandzhafarov wants to merge 10 commits intolayoutBox:masterfrom
Conversation
Sources/PinLayout+WrapContent.swift
Outdated
| let subviews: [PinView.PinView] | ||
| switch viewFilter { | ||
| case .visibleOnly: | ||
| subviews = view.subviews.filter { !$0.isHidden } |
There was a problem hiding this comment.
What about views with alpha = 0?
There is public visible(_ views: [UIView]) views filter that takes alpha into account -
PinLayout/Sources/Filters.swift
Line 25 in babea9c
There was a problem hiding this comment.
Good point, you could use the visible() here to filter views.
Sources/PinLayout+WrapContent.swift
Outdated
|
|
||
| private func wrapContent(_ type: WrapType, padding: PEdgeInsets, _ context: Context) -> PinLayout { | ||
| let subviews = view.subviews | ||
| private func wrapContent(_ type: WrapType, padding: PEdgeInsets, viewFilter: ViewFilter = .none, _ context: Context) -> PinLayout { |
There was a problem hiding this comment.
do we need default argument value (viewFilter = .none) in private function?
There was a problem hiding this comment.
Not needed here, the parameter should always be specified by callers
lucdion
left a comment
There was a problem hiding this comment.
Excellent. Could you update the documentation of wrapContent (README.md)? 🙏
Sources/PinLayout+WrapContent.swift
Outdated
| let subviews: [PinView.PinView] | ||
| switch viewFilter { | ||
| case .visibleOnly: | ||
| subviews = view.subviews.filter { !$0.isHidden } |
There was a problem hiding this comment.
Good point, you could use the visible() here to filter views.
| } | ||
|
|
||
| public var isVisible: Bool { | ||
| !isHidden && alphaValue > 0 |
There was a problem hiding this comment.
| !isHidden && alphaValue > 0 | |
| return !isHidden && alphaValue > 0 |
| } | ||
|
|
||
| public var isVisible: Bool { | ||
| !isHidden && alpha > 0 |
There was a problem hiding this comment.
| !isHidden && alpha > 0 | |
| return !isHidden && alpha > 0 |
|
bump |
Force rebuild
No description provided.