Setting the scroll view's automaticallyAdjustsContentInsets property to false solved my problem.
In my case, I needed to set it to scrollView.contentView rather than the scroll view itself, like this:
swift
scrollView.automaticallyAdjustsContentInsets = false
scrollView.contentInsets = .init(top: 20, left: 0, bottom: 0, right: 0)
Topic:
App & System Services
SubTopic:
Core OS
Tags: