diff --git a/CHANGELOG.md b/CHANGELOG.md index faad76ea..7d064054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The changelog for `Hero`. Also see the [releases](https://github.com/HeroTransit ## Upcoming release +### Changed + +- The hidden state of subviews are now taken into account in optimized snapshot type for `UIImageView`. +[#521](https://github.com/HeroTransitions/Hero/pull/521) by [@ManueGE](https://github.com/ManueGE) + ## [1.4.0](https://github.com/HeroTransitions/Hero/releases/tag/1.4.0) ### Added diff --git a/Sources/HeroContext.swift b/Sources/HeroContext.swift index 8246cc9b..14e90978 100644 --- a/Sources/HeroContext.swift +++ b/Sources/HeroContext.swift @@ -174,7 +174,7 @@ extension HeroContext { #else if #available(iOS 9.0, *), let stackView = view as? UIStackView { snapshot = stackView.slowSnapshotView() - } else if let imageView = view as? UIImageView, view.subviews.isEmpty { + } else if let imageView = view as? UIImageView, view.subviews.filter({!$0.isHidden}).isEmpty { let contentView = UIImageView(image: imageView.image) contentView.frame = imageView.bounds contentView.contentMode = imageView.contentMode