How to modify binding value in SwiftUI

Satsuki Hashiba
Apr 21, 2021

--

Photo by Sandra Wei on Unsplash

For Example

If you want to get a beginning of a date, you may use a DatePicker. But it will provide a date with a current time even if its displayedComponents is only .date. You might think how to modify an input value before binding.

Solution

You can preprocess an input value by using Binding instead of State.

--

--