Use the .overlay with a view and the built-in Capsule shape to create a capsule button with text in SwiftUI.
Author Archives: Paul Young-Suk Lee
How to detect first time app launch in SwiftUI
You can use @AppStorage in SwiftUI which wraps over UserDefaults to detect whether a user has been onboarded onto your app or not.
How to indicate page index on pagination with TabView in SwiftUI
You can use indexViewStyle and set the display to always to show to users which page they are on within TabView.
How to implement pagination in SwiftUI
Use TabView alongside PageTabViewStyle to implement pagination in SwiftUI.
How to drag views around with DragGesture
You can use a combination of absolute positioning and DragGesture to create a view that can be dragged around by users.
How to deactivate (disable) buttons in SwiftUI
Use the .disabled modifier on views to deactivate any elements with a boolean value set to true.
How to detect tap gestures in SwiftUI
Use the handy onTapGesture method to recognize taps on views.
How to detect a dragging motion with DragGesture in SwiftUI
Use the DragGesture struct within a .gesture modifier to detect any type of dragging motion alongside the methods of .onChanged and .onEnded with the DragGesture.
How to make views disappear in SwiftUI with DispatchQueue
You can make views disappear after some delay by utilizing the DispatchQueue to schedule async work after some amount of time which toggles a boolean value to make a view appear or disappear.
How to set the size of SF Symbols in SwiftUI?
Because SF Symbols are similar to fonts you can set the size directly with the .font modifier and passing in a size.