DEV Community

ArshTechPro
ArshTechPro

Posted on

WWDC 2025 - Make your UIKit app more flexible

Building Flexible UIKit Apps: Key Takeaways from WWDC

Creating apps that work seamlessly across different screen sizes and platforms is more important than ever. The UIKit team shared essential best practices for building flexible UIKit applications that deliver amazing experiences regardless of device or window size.

The Foundation: UIScene Lifecycle

Scenes are the cornerstone of flexible apps. A scene represents an instance of your app's UI, containing view controllers and views while providing crucial functionality:

  • Independent state management - Each scene saves and restores its UI state independently
  • External data handling - Built-in support for deep linking and URL handling
  • Context awareness - Provides screen and window geometry information
  • Multiple scene support - Different scene types for distinct experiences (like a dedicated compose scene in messaging apps)

Important update: Starting with the major release following iOS 26, UIScene lifecycle will be mandatory when building with the latest SDK. While supporting multiple scenes is encouraged, adopting the scene lifecycle is what's required.

Container View Controllers: Your Flexibility Powerhouse

UISplitViewController Enhancements

UISplitViewController received significant updates that make apps more flexible:

Interactive Column Resizing

  • Drag separators to resize columns
  • Pointer shape adapts to indicate resize directions
  • Customizable minimum, maximum, and preferred widths for each column

Adaptive Layout Awareness

  • New splitViewControllerLayoutEnvironment trait indicates whether the controller is expanded or collapsed
  • UI elements can adapt accordingly (like showing disclosure indicators when collapsed)

Inspector Column Support

  • First-class support for inspector columns that show additional details
  • Automatically adapts: displays on trailing edge when expanded, presents as sheet when collapsed
  • Simple API: specify a view controller and call show() to display

UITabBarController Cross-Platform Adaptation

UITabBarController automatically adapts its appearance across platforms:

  • iPhone: Tab bar at bottom
  • Mac: Can reside in toolbar or display as sidebar
  • Apple Vision Pro: Displayed as ornament on leading edge
  • iPad: Resides at top alongside navigation controls, can adapt to sidebar

Tab Groups provide additional flexibility by surfacing collections of content in sidebars, with seamless API management for this adaptation.

Building Adaptive UI

Safe Area and Layout Considerations

Always respect the safe area - the region appropriate for interactive content that won't be covered by navigation bars, toolbars, or system UI like the Dynamic Island.

Key techniques:

  • Use layout guides for standard margins around content
  • Layout margins are inset from safe area by default
  • Background can extend outside safe area while keeping content within it

New iPadOS 26 Features

Window Controls

  • Scenes gain close, minimize, and arrange controls similar to macOS
  • System components like UINavigationBar adapt automatically
  • Use layout guides with horizontal corner adaptation for bar-like content

Interface Orientation Management

  • View controllers can prefer locked orientation when beneficial (like driving games)
  • Override prefersInterfaceOrientationLocked and call setNeedsUpdateOfPrefersInterfaceOrientationLocked when preferences change
  • Observe lock state through didUpdateEffectiveGeometry

Performance Optimization

For computationally expensive UI elements:

  • Query isInteractivelyResizing to avoid unnecessary re-rendering during resize interactions
  • Only update expensive assets after resize interactions complete
  • This is particularly important for games with multiple assets that need resizing

Key Compatibility Updates

Deprecated Features

  • UIRequiresFullscreen Info.plist key is deprecated and will be ignored in future releases
  • Apps should remove this key if they're truly adaptable

SDK Changes

  • Building with iOS 26 SDK eliminates automatic scaling/letterboxing for new screen sizes
  • Your app will need to handle new screen sizes natively rather than relying on system scaling

Action Items for Developers

  1. Adopt UIScene lifecycle - This will soon be mandatory and provides the foundation for flexibility
  2. Leverage container view controllers - Use UISplitViewController and UITabBarController for their built-in adaptability
  3. Implement adaptive UI patterns - Use layout guides, respect safe areas, and handle window controls properly
  4. Remove deprecated compatibility modes - Remove UIRequiresFullscreen and prepare for native screen size handling
  5. Optimize for performance - Use isInteractivelyResizing to avoid expensive operations during resize interactions

The Bottom Line

Flexible apps empower users to interact with their devices however they prefer. By adopting these patterns and APIs, you ensure your app delivers great experiences across any screen size, orientation, or platform configuration. The investment in flexibility pays dividends in user satisfaction and future-proofing your application.

The UIKit team has provided powerful tools to make this transition smooth - now it's time to implement these best practices and create truly flexible applications.

Top comments (0)