-
Animate symbols in your app
Bring delight to your app with animated symbols. Explore the new Symbols framework, which features a unified API to create and configure symbol effects. Learn how SwiftUI, AppKit, and UIKit make it easy to animate symbols in user interfaces. Discover tips and tricks to seamlessly integrate the new animations alongside other app content. To get the most from this session, we recommend first watching “What's new in SF Symbols 5.”
Recursos
Vídeos relacionados
WWDC23
-
Buscar neste vídeo...
-
-
6:02 - Symbol effects in SwiftUI
// Symbol effects in SwiftUI Image(systemName: "wifi.router") .symbolEffect(.variableColor.iterative.reversing) .symbolEffect(.scale.up) -
6:02 - Symbol effects in AppKit and UIKit
let imageView: NSImageView = ... imageView.addSymbolEffect(.variableColor.iterative.reversing) imageView.addSymbolEffect(.scale.up) -
6:49 - Indefinite symbol effects in SwiftUI
struct ContentView: View { @State var isConnectingToInternet: Bool = true var body: some View { Image(systemName: "wifi.router") .symbolEffect( .variableColor.iterative.reversing, isActive: isConnectingToInternet ) } } -
7:09 - Indefinite symbol effects in AppKit and UIKit
let imageView: NSImageView = ... imageView.addSymbolEffect(.variableColor.iterative.reversing) // Later, remove the effect imageView.removeSymbolEffect(ofType: .variableColor) -
8:26 - Discrete symbol effects in SwiftUI
struct ContentView: View { @State var bounceValue: Int = 0 var body: some View { VStack { Image(systemName: "antenna.radiowaves.left.and.right") .symbolEffect( .bounce, options: .repeat(2), value: bounceValue ) Button("Animate") { bounceValue += 1 } } } } -
8:26 - Discrete symbol effects in AppKit and UIKit
let imageView: NSImageView = ... // Bounce imageView.addSymbolEffect(.bounce, options: .repeat(2)) -
9:40 - Content transition symbol effects in SwiftUI
struct ContentView: View { @State var isPaused: Bool = false var body: some View { Button { isPaused.toggle() } label: { Image(systemName: isPaused ? "pause.fill" : "play.fill") .contentTransition(.symbolEffect(.replace.offUp)) } } } -
9:57 - Content transition symbol effects in AppKit and UIKit
let imageView: UIImageView = ... imageView.image = UIImage(systemName: "play.fill") // Change the image with a Replace effect let pauseImage = UIImage(systemName: "pause.fill")! imageView.setSymbolImage(pauseImage, contentTransition: .replace.offUp) -
11:14 - Indefinite Appear and Disappear symbol effects in SwiftUI
struct ContentView: View { @State var isMoonHidden: Bool = false var body: some View { HStack { RoundedRectangle(cornerRadius: 5) Image(systemName: "moon.stars") .symbolEffect(.disappear, isActive: isMoonHidden) Circle() } } } -
11:30 - Indefinite Appear and Disappear symbol effects in AppKit and UIKit
let imageView: UIImageView = ... imageView.image = UIImage(systemName: "moon.stars") imageView.addSymbolEffect(.disappear) // Re-appear the symbol imageView.addSymbolEffect(.appear) -
12:38 - Transition symbol effects in SwiftUI
struct ContentView: View { @State var isMoonHidden: Bool = false var body: some View { HStack { RoundedRectangle(cornerRadius: 5) if !isMoonHidden { Image(systemName: "moon.stars") .transition(.symbolEffect(.disappear.down)) } Circle() } } } -
12:59 - Appear and Disappear symbol effects in UIKit with completion handler
let imageView: UIImageView = ... imageView.image = UIImage(systemName: "moon.stars") imageView.addSymbolEffect(.disappear) { context in if let imageView = context.sender as? UIImageView, context.isFinished { imageView.removeFromSuperview() } } -
14:19 - Symbol effect propagation in SwiftUI
VStack { Image(systemName: "figure.walk") .symbolEffectsRemoved() Image(systemName: "car") Image(systemName: "tram") } .symbolEffect(.pulse) -
14:55 - Effects without animation in SwiftUI
struct ContentView: View { @State var isScaledUp: Bool = false var body: some View { Image(systemName: "iphone.radiowaves.left.and.right") .symbolEffect(.scale.up, isActive: isScaledUp) .onAppear { var transaction = Transaction() transaction.disablesAnimations = true withTransaction(transaction) { isScaledUp = true } } } } -
15:06 - Effects without animation in AppKit and UIKit
// Effects without animation in AppKit and UIKit let imageView: UIImageView = ... imageView.image = UIImage(systemName: "iphone.radiowaves.left.and.right") imageView.addSymbolEffect(.disappear, animated: false) -
15:44 - Variable value animations in SwiftUI
struct ContentView: View { @State var signalLevel: Double = 0.5 var body: some View { Image(systemName: "wifi", variableValue: signalLevel) } } -
16:07 - Variable value animations in AppKit and UIKit
let imageView: UIImageView = ... imageView.image = UIImage(systemName: "wifi", variableValue: 1.0) // Animate to a different Wi-Fi level let currentSignalImage = UIImage( systemName: "wifi", variableValue: signalLevel )! imageView.setSymbolImage(currentSignalImage, contentTransition: .automatic)
-