Carta de Clarice

Ele enxergava em mim o que ninguém enxergava, o que até eu não enxergava em mim mesma. Ele dizia que eu era linda e que um dia iríamos nos casar. Eu, sempre falei que tínhamos uma juventude inteira…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Button Style Animation in SwiftUI

The ButtonStyle protocol requires the makeBody(configuration: Configuration) function to be implemented where we get the opportunity to customize our button.

Let’s take an example for this, we will create a new struct called “CustomButtonStyle” which will conform to the ButtonStyle protocol. We will provide a definition for the makeBody function for customization. Our button will change background when pressed and will scale in size when the button is in a pressed state. Configuration parameter gives us access to button’s label along with button’s role and isPressed state. We will employ, isPressed state to animate these changes as shown below::

Let’s apply this style to a button view:

Add a comment

Related posts:

Jane Doe Case Unsolved Since 40 Years

This murder in Chautauqua County, New York, remains unsolved despite there being a photograph of the woman. It has been around 40 years. The tragedy is that we still don’t know the woman’s name. That…

The Best Resources for Learning Shiny App Development

The Hosting Data Apps website is dedicated to help you learn about your hosting options. As outlined in the opening post, data app development related content is kept to a minimum. In this post we…

The Ultimate Gamble

As she walked through the airport, she kept her eyes down. Everyone knew the stories of the airport people here. The ones who sat down for a hopeful quick win and never got up again. The ones who…