SwiftUI How to clear/reset SwiftUI Preview Caches? If you run into any SwiftUI Preview related issue, then there are high chance that you are facing that issue due to some cached preview data. Here are the steps to reset the SwiftUI Preview Caches: 1. Close Xcode. 2. Run the following command in the terminal: xcrun simctl --set...
SwiftUI SwiftUI focusSection - UIFocusGuide Alternative for SwiftUI? Use the focusSection view modifier in SwiftUI as an alternative to the UIFocusGuide in UIKit to focus diagonally in tvOS apps by creating larger logical focus targets....
SwiftUI How to Create Custom Environment Values in SwiftUI? Create custom environment key values in SwiftUI using EnvironmentKey protocol and EnvironmentValues extension. The Environment property wrapper can read custom environment key values....
SwiftUI Implement Push Notifications in SwiftUI Application Add AppDelegate class with push notification callback functions to the SwiftUI app and link it with the SwiftUI app using the UIApplicationDelegateAdaptor property wrapper....
SwiftUI Add AppDelegate to SwiftUI app When we create a new SwiftUI project in Xcode then it doesn't include the AppDelegate which we might need for different functionality like push notifications. The new SwiftUI main app file looks like this - import SwiftUI @main struct SampleApp: App { var body: some Scene { WindowGroup { ContentView() } } } In...