View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Explore SwiftUI animation

    Explore SwiftUI's powerful animation capabilities and find out how these features work together to produce impressive visual effects. Learn how SwiftUI refreshes the rendering of a view, determines what to animate, interpolates values over time, and propagates context for the current transaction.

    Capítulos

    • 1:03 - Anatomy of an update
    • 6:40 - Animatable
    • 11:36 - Animation
    • 20:00 - Transaction

    Recursos

      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Animate with springs
    • Demystify SwiftUI performance
    • Meet MapKit for SwiftUI
    • What’s new in SwiftUI
    • Wind your way through advanced animations in SwiftUI
  • Buscar neste vídeo...
    • 2:14 - Pet Avatar - Unanimated

      struct Avatar: View {
          var pet: Pet
          @State private var selected: Bool = false
      
          var body: some View {
              Image(pet.type)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .onTapGesture {
                      selected.toggle()
                  }
          }
      }
    • 4:13 - Pet Avatar - Animated

      struct Avatar: View {
          var pet: Pet
          @State private var selected: Bool = false
      
          var body: some View {
              Image(pet.type)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .onTapGesture {
                      withAnimation {
                          selected.toggle()
                      }
                  }
          }
      }
    • 11:49 - Pet Avatar - Explicit Animation

      struct Avatar: View {
          var pet: Pet
          @State private var selected: Bool = false
      
          var body: some View {
              Image(pet.type)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .onTapGesture {
                      withAnimation(.bouncy) {
                          selected.toggle()
                      }
                  }
          }
      }
    • 12:48 - UnitCurve Model

      let curve = UnitCurve(
          startControlPoint: UnitPoint(x: 0.25, y: 0.1),
          endControlPoint: UnitPoint(x: 0.25, y: 1))
      curve.value(at: 0.25)
      curve.velocity(at: 0.25)
    • 13:56 - Spring Model

      let spring = Spring(duration: 1.0, bounce: 0)
      spring.value(target: 1, time: 0.25)
      spring.velocity(target: 1, time: 0.25)
    • 17:25 - MyLinearAnimation

      struct MyLinearAnimation: CustomAnimation {
          var duration: TimeInterval
      
          func animate<V: VectorArithmetic>(
              value: V,
              time: TimeInterval,
              context: inout AnimationContext<V>
          ) -> V? {
              if time <= duration {
                  value.scaled(by: time / duration)
              } else {
                  nil // animation has finished
              }
          }
      }
    • 19:50 - MyLinearAnimation with Velocity

      struct MyLinearAnimation: CustomAnimation {
          var duration: TimeInterval
      
          func animate<V: VectorArithmetic>(
              value: V, time: TimeInterval, context: inout AnimationContext<V>
          ) -> V? {
              if time <= duration {
                  value.scaled(by: time / duration)
              } else {
                  nil // animation has finished
              }
          }
      
          func velocity<V: VectorArithmetic>(
              value: V, time: TimeInterval, context: AnimationContext<V>
          ) -> V? {
              value.scaled(by: 1.0 / duration)
          }
      }
    • 22:44 - Pet Avatar - Animation Modifier

      struct Avatar: View {
          var pet: Pet
          @Binding var selected: Bool
      
          var body: some View {
              Image(pet.type)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .animation(.bouncy, value: selected)
                  .onTapGesture {
                      selected.toggle()
                  }
          }
      }
    • 23:44 - Pet Avatar - Multiple Animation Modifiers

      struct Avatar: View {
          var pet: Pet
          @Binding var selected: Bool
      
          var body: some View {
              Image(pet.type)
                  .shadow(radius: selected ? 12 : 8)
                  .animation(.smooth, value: selected)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .animation(.bouncy, value: selected)
                  .onTapGesture {
                      selected.toggle()
                  }
          }
      }
    • 25:20 - Generic Avatar - Scoped Animation Modifiers

      struct Avatar<Content: View>: View {
          var content: Content
          @Binding var selected: Bool
      
          var body: some View {
              content
                  .animation(.smooth) {
                      $0.shadow(radius: selected ? 12 : 8)
                  }
                  .animation(.bouncy) {
                      $0.scaleEffect(selected ? 1.5 : 1.0)
                  }
                  .onTapGesture {
                      selected.toggle()
                  }
          }
      }
    • 28:45 - Pet Avatar - Transaction Modifier

      struct Avatar: View {
          var pet: Pet
          @Binding var selected: Bool
      
          var body: some View {
              Image(pet.type)
                  .scaleEffect(selected ? 1.5 : 1.0)
                  .transaction(value: selected) {
                      $0.animation = $0.avatarTapped
                          ? .bouncy : .smooth
                  }
                  .onTapGesture {
                      withTransaction(\.avatarTapped, true) {
                          selected.toggle()
                      }
                  }
          }
      }
      
      private struct AvatarTappedKey: TransactionKey {
          static let defaultValue = false
      }
      
      extension Transaction {
          var avatarTapped: Bool {
              get { self[AvatarTappedKey.self] }
              set { self[AvatarTappedKey.self] = newValue }
          }
      }
    • 28:58 - Generic Avatar - Scoped Transaction Modifier

      struct Avatar<Content: View>: View {
          var content: Content
          @Binding var selected: Bool
      
          var body: some View {
              content
                  .transaction {
                      $0.animation = $0.avatarTapped
                          ? .bouncy : .smooth
                  } body: {
                      $0.scaleEffect(selected ? 1.5 : 1.0)
                  }
                  .onTapGesture {
                      withTransaction(\.avatarTapped, true) {
                          selected.toggle()
                      }
                  }
          }
      }
      
      private struct AvatarTappedKey: TransactionKey {
          static let defaultValue = false
      }
      
      extension Transaction {
          var avatarTapped: Bool {
              get { self[AvatarTappedKey.self] }
              set { self[AvatarTappedKey.self] = newValue }
          }
      }

Developer Footer

  • Vídeos
  • WWDC23
  • Explore SwiftUI animation
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines