I want to create a view for displaying stock price. When price goes up, it will turn green. When price goes down, it will turn red. And it will return to black when price didn’t update for a specific of time.

Firstly, in order to compare with previous price…

I will demonstrate on how to create a customised button in SwiftUI.

Firstly I will create a MaterialColor enum that will define different color sets so that I can create button with different color easily.

Then I create the customized ButtonStyle:

that will:

  • set minHeight to 44.0
  • add…

Water Lou

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store