Vincent Tourraine

Notes WWDC 2021 : Focus on iPad keyboard navigation

#dev #iOS

Mes notes pour la session Focus on iPad keyboard navigation de la WWDC 2021.

With iOS 15 SDK, keyboard navigation enabled by default for:

Opt-in for:

Focus system: same as tvOS, with additional features


override var canBecomeFocused: Bool { true }
class MyViewController: UICollectionViewController {
  override func viewDidLoad() {
    self.collectionView.allowsFocus = true

class MyCollectionViewDelegate: NSObject, UICollectionViewDelegate {
  func collectionView(_ collectionView: UICollectionView, canFocusItemAt indexPath: IndexPath) -> Bool {
    return true


“Halo” as the default effect, customizable

let focusEffect = UIFocusHaloEffect(roundedRect: self.bounds, cornerRadius: self.layer.cornerRadius, curve: .continuous)

// make sure the effect is added right above the image view
focusEffect.referenceView = self.imageView

// make sure the effect is added to our scroll view
focusEffect.containerView = self.scrollView

self.focusEffect = focusEffect

selectionFollowsFocus, available on collection views and table views. Can also be customized cell by cell.

Focus groups

Responder chain

Focus and first responder synchronized.