
The article describes a horizontal ScrollView with cards of varying heights. The goal was to make all cards match the height of the tallest one. Using .frame(maxHeight: .infinity) alone caused each card to stretch to the full screen height because the HStack had no height constraint. The solution was adding .fixedSize(horizontal: false, vertical: true) to the HStack, which tells it to ignore the parent's height proposal and size itself to its ideal content height (the tallest card). The two modifiers work together: .fixedSize sets the correct container height, and .frame(maxHeight: .infinity) fills it.
Omar Elsayed is an iOS software engineer and photographer. SwiftDifferently started as a place to collect his thoughts while learning iOS development and slowly grew into a space for sharing everything he has discovered along the way. Created by Omar, this site reflects his curiosity as an iOS software engineer who enjoys digging beneath the surface to understand how things truly work, from Swift internals to the architectural decisions behind well crafted apps. Coding for Omar is closely connected to photography; both reward patience, perspective, and attention to detail. That mindset shapes how he writes, teaches, and builds. SwiftDifferently exists because knowledge feels incomplete when it is kept to yourself, and this is his way of passing it forward through blogs and workshops. If you are curious to see the creative side that lives outside of code, you can also visit his photography website and explore the stories he tells through images.