Skip to content

Conversation

@swipip
Copy link

@swipip swipip commented Nov 15, 2023

Summary

As a client of the SDK I need to be able to set a custom animation type.

The animation currently defaults to spring() which takes a bit to long to complete. I added to possibility to override the default behavior with a Animation injected through a closure.

Technical decisions

Animation is injected through a closure allowing the client to perform run time logic. Animation closure is optional in initializer so the changes would not be breaking for existing clients. Current default behavior is maintained.

Call site exemple

            ACarousel(roles,
                      id: \.self,
                      index: $currentIndex,
                      spacing: spacing,
                      headspace: headspace,
                      sidesScaling: sidesScaling,
                      isWrap: isWrap,
                      autoScroll: autoScroll ? .active(time) : .inactive) { name in
                Image(name)
                    .resizable()
                    .scaledToFill()
                    .frame(height: 300)
                    .cornerRadius(30)
            } animation: {
                .easeInOut(duration: 0.3)
            }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant