Creating a Segmented Control in SwiftUI

Stephen Feuerstein Tutorials

How do you think you would create a segmented control in SwiftUI? Just use UISegmentedControl, right? Wrong! Similar to the change a while back with UIAlertView rolling into a style under UIAlertController, SwiftUI introduces a View called Picker that has different styles. Setting Up First let’s get set up with what data we’re going to display with our segmented control. …

Creating a Repeating Animation in SwiftUI

Stephen Feuerstein Tutorials

SwiftUI is so amazing because of how much it takes care of for you. When you update the state your view updates automatically. Throw a call to withAnimation in there and it will even animate the changes! But what if you want an animation that repeats? Creating the Animation First thing we need to do is set up our View …

Understanding State in SwiftUI

Stephen Feuerstein Tutorials

Building pretty looking views is super easy with SwiftUI, but apps need to be more than just something nice to look at. Apps need to do things, then give the user feedback by updating the UI accordingly. With SwiftUI in order to update a View you need to change its state. What is @State? @State is what is called a …