What’s new in SwiftUI


SwiftUI in more places

  • Containers have been updated to address VisionOS – you can add .volumetric to a WindowView
  • RealityView
  • ImmersiveSpace {} Scene type allows for full emersion or mixed to create a AR view
  • Redesigned UX on watchOS 10, is based on existing SwiftUI views.  Get new transitions
    • .containerBackground modifier will allow for transitions in push and pop
    • ToolbarItem(placement: .topBarTrailing and .bottomBar}
    • Date Picker and Selection in List have been added to Apple Watch
  • Widgets on iPad, Home Screen, Desktop, and interactive controls
  • New framework updates for SwiftUI – Focus on major updates to MapKit – (will need to see how I can reformat my Map integrations – Meet MapKit for SwiftUI), ChartKit has scrolling charts, donuts, and pie charts.

Simplified Data Flow

  • Start with data model created in SwiftData
    • @Observable models use SwiftUI patterns but for DataFlow, if you pass a model thru intermediate views, they won’t get invalidated if they don’t use the property in the model
    • Confirm session Discover Observation with SwiftUI
  • SwiftData are represented entirely by code. Will receive persistence and observable.
    • Add a .modelContainer to you App View
    • Add @Query to model in your views (tells swift data to do a fetch from database).  Also works for document based apps.
  • Document Groups – automatically get sharing, renaming and more
  • Inspectors – create side bars or sheets based on platform.
  • Dialog customization
    • Help Links – 
  • Lists and Tables for fine tuning them.
    • Tables – Column order and visibility, and new Disclosure Table rows (for grouping)
    • Sections now have programmatic expansion.
    • Style formatting for smaller lists or tables.

Extraordinary animations

  • Animations can be improved with KeyFrames – triggered by state change. (Runs a set of animations in parallel)
  • Phase animators (simpler than KeyFrame – step thru a sequence of animations)
  • Haptic feedback uses new SensoryFeedback API – add a modifier .sensoryFeedback check HIG for Playing Haptics
  • .visualEffects modifier – don’t need geometry reader, to allow for an animation based on position on the screen.
  • You can do text interpolation with .foregroundStyle so you can do cool metal shaders using ShaderLibrary.
  • Sliders now have .symbolEffect modifier (can do it at a single item or the entire view).  Check out (Animate Symbols in your app)
  • You can do .textScale to a text view.
  • .typesettingLanguage modifier will allow for text that requires more space like some languages (Thai)

Enhanced interactions

  • .scrollTransition modifier will allow effects to items in a scroll view.
  • .containerRelativeFrame modifier allows for making things relative to other screen parts
  • .scrollTargetLayout()  
  • .scrollPosition allows your do some thing based on position within the scroll view.
  • .allowedDynamicRange modifier is now supported to show full fidelity, use sparingly (must be a performance hog)
  • New Accessibility options. You can add .accessibilityZoomAction so voice over can access other actions like swipe actions.
  • Color can look up customer colors defined in your asset Catalog.
  • Menus now have improved visual styles
  • New BorderShape styles for buttons 
  • .onKeyPress – allows for actions based on key presses (with modifiers)
,