FairPlay Streaming Error Codes
When working with FairPlay Streaming (FPS), we may encounter errors with random error codes that lack proper documentation or explanation. An example of such an error is: Error Domain=CoreMediaErrorDomain Code=-42803 "(null)" Various errors may occur when working on FairPlay Streaming. The following provides the error codes
Apple Fairplay Streaming Overview
Apple's FairPlay Streaming (FPS) is a DRM (Digital Right Management) technology used to securely deliver streaming media content to devices. It works with the HTTP Live Streaming (HLS) protocol. Here are some key points about FPS: * FPS allows content providers to encrypt content, securely exchange keys, and protect
How to measure function execution time in Swift?
Runtime code execution duration monitoring is crucial. Swift provides ContinuousClock to measures the time that always increments. The ContinuousClock acts like a stopwatch, measuring time relative to when a program starts or some other specific reference point. This is suitable for high resolution measurements of execution. 1. Measure function execution
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
Use Xcode 14 to run/debug code on iOS 17 or tvOS 17
As you might know, Apple doesn't include the iOS 17 or tvOS 17 device support files in Xcode 15. So, the old trick of copy-paste the device support files from newer Xcode to older Xcode is not possible. But there is a trick in Xcode 14 which
Fix Xcode 15 DT_TOOLCHAIN_DIR cannot be used to evaluate LIBRARY_SEARCH_PATHS, use TOOLCHAIN_DIR instead
In Xcode 15 Apple changed the variable which points to the default toolchain location to $TOOLCHAIN_DIR from $DT_TOOLCHAIN_DIR. If some project/target used $DT_TOOLCHAIN_DIR then it need to be replace by $TOOLCHAIN_DIR. 1. Find DT_TOOLCHAIN_DIR Reference To find out where in your
Execute async/await method from Swift Command Line (CLI) Application
Call an async/await function (with or without throws) from the Swift Command Line Application using the spacial @main attribute to prevent the CLI application from exiting before the asynchronous operation completes.
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.
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.
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.
Test Development/Production Push Notification using Apple Push Notification Console
Apple announced the new Push Notification Console for testing the Development and Production push notification. The new Push Notifications Console makes it easy to send test notifications to Apple devices through the Apple Push Notification service (APNs). You can access logs that provide insights into the delivery process and leverage
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 order