Post

Replies

Boosts

Views

Activity

Dynamic Island SwiftUI Animations
Hi! How can I implement swiftUI animations on a dynamic island icon? I want to do this: DynamicIsland() {} compactLeading: { Image("my-icon").shineEffect() } compactTrailing: {   Image("my-icon") } Where in shine effect I start the animation on onAppear: func body(content: Content) -> some View { content     .onAppear() {      startAnimation()     } } In the main app it works, but in the dynamic island it doesn't.
0
1
769
Nov ’22
[SwiftUI] fill a View inside a switch
Hi! Does anyone know a correct way to do the following: I have a view which produces a path and I want to fill it either with a color or with a gradient (which are different types). For this, I have a enum which I pass to the view from the parent view: enum FillColor {   case color(_ color: Color)   case gradient(color1: Color, color2: Color) } Inside a view, I have a path:  var body: some View {   GeometryReader { geometry in     Path { path in ... }    }    } I then need to switch and do smth like: switch color { case .color(let c):    path.fill(c)   case .gradient(let c1, let c2):     let gradient = ...     path.fill(gradient) } Do I create a variable for a Path? But I need to use GeometryReader as well.
0
0
418
Jul ’21