Skip to content

Instantly share code, notes, and snippets.

@danurna
Created July 26, 2022 09:26
Show Gist options
  • Save danurna/4f4e4faa5315b0448a2538bab344c590 to your computer and use it in GitHub Desktop.
Save danurna/4f4e4faa5315b0448a2538bab344c590 to your computer and use it in GitHub Desktop.
CatViewController Sample
class CatViewController: UIViewController {
lazy var stackView: UIStackView = {
let stackView = UIStackView(arrangedSubviews: [
titleLabel,
catsView
])
stackView.axis = .vertical
stackView.distribution = .fill
return stackView
}()
lazy var catsView: CatsUIView = {
let catsView = CatsUIView()
// Experiment: Disable this and compare it running on iOS 14 and iOS 15
catsView.setContentCompressionResistancePriority(.required, for: .vertical)
return catsView
}()
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment