Skip to content

Instantly share code, notes, and snippets.

@kirti-swiggy
Last active July 22, 2025 08:38
Show Gist options
  • Save kirti-swiggy/28deb56180fdde84983dbe89a8cb726c to your computer and use it in GitHub Desktop.
Save kirti-swiggy/28deb56180fdde84983dbe89a8cb726c to your computer and use it in GitHub Desktop.
The Vasco da Gama In Me

My fuck-around-and-find-out moments

With Texture (formerly AsyncDisplayKit)

  • If the shadow inside section controller is being clipped off. Make clipsToBound/layer.maskToBound false for ASCellNode
  • If you are facing animation issues with Texture, try to group the concerned nodes in a container node and just animate the container. Don't use setNeedsLayout or layoutIfNeeded for root node (imp)
  • If your view's frame is important to you and applying transform in an UIView animation block making it jump, try using CABasicAnimation. One latent benefit is CABasicAnimation runs on a 'proxy' layer so your host view won't get affected.
  • Sometimes when we apply gradient background to a node, gradient layer appears on top of content even if it's added to the begining of sublayer hierarchy. One hack to fix this is to set zPosition of gradient layer to -.greatestFiniteMagnitude
  • If you are using ASBackgroundLayoutSpec and the node that is supposed to be in background appears on top of other content you need to manually manage subnodes (automaticallyManagesSubnodes = false). Also add backgroundNode Subnode first before adding other subnodes.

With SwiftUI

  • If there is a composite view and different layers are not animating in sync, use drawingGroup or geometryGroup . One of the two would surely work. Reference article.
  • TabView is weirdly engineered. It doesn't hugs the content. For a dynamic content TabView, use geometry reader first to get the intrinsic height ans then assign it a fixed height. Also, in a peculiar case TabView's content was shifted a bit up. I had to wrap it in a ScrollView (with scroll disabled) to make it work.
  • safeAreaInset(edge: .top, alignment: .leading) to place something like a backbutton. Can (haven't tried yet?) also be used to stick a content to bottom
  • TabView uses UIcollectionView beneath. On SO and multiple other places, it's written that it uses UIPageViewController which is wrong. Also, TabView with page style has the lazy loading capability but is highly constrained. For v simple paged carousels, I found it better that ScrollView + LazyHStack combo (surprise, surprise...)
  • (Maybe a well-known fact but still) If you are optimising for performance look out for frame, offset, padding etc updates. These consume CPU cycles and are costly. Consider using equivalent transformations like scaleTransform etc as these are performed by GPU. Same theory applies to UIKit context as well.

General purpose stuff


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment