{
  "$type": "site.standard.document",
  "path": "/2022-06-07-custom-detent-height-in-ios-16/",
  "publishedAt": "2022-06-07T07:45:00.000Z",
  "site": "at://did:plc:ex23caczr45rodrfcxrwps6h/site.standard.publication/self",
  "tags": [
    "code"
  ],
  "textContent": "Prior to iOS 16, UISheetPresentationController only supported two detents: medium and large. With iOS 16, we can now create our own detent with a custom height.\n\nsheetPresentationController?.detents = [.medium(), .large()]\n\nIn iOS 16, create a detent identifier and then create a detent with that identifier and provide a maximum height.\n\nlet smallId = UISheetPresentationController.Detent.Identifier(\"small\")\n\nlet smallDetent = UISheetPresentationController.Detent.custom(identifier: smallId) { context in\nreturn 80\n}\n\nsheetPresentationController?.detents = [smallDetent, .medium(), .large()]",
  "title": "Create a Detent with a Custom Height in iOS 16"
}