Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This applies the workaround mentioned in #9 for restoring XCode previews.
Context
Currently users are required to enable
Use Legacy Previews Execution
in order to use XCode's screen preview functionality. The previews fail to load with an error "Failed to launch app [App name] in reasonable time". The diagnostics report provided does not seem to provide any meaningful information to assist with debugging.PowerSync SPM Package Context
The PowerSync SPM package currently includes a
PowerSync
library
product
which uses the default value for thetype
setting. According to the SPM docs for thetype
setting:We therefore currently support both static and dynamic linking with the
PowerSync
library productXCode Previews Context
Some background on how XCode previews are executed can be found here.
It seems like for Previews XCode will build the application as a dynamically linked project. ENABLE_DEBUG_DYLIB_SUPPORT is required for previews to function.
There are multiple potential issue threads on the XCode forums related to Previews not loading:
While our SPM package should theoretically allow consumers to specify the linkage type, I could not find any trivial method of configuring the current
PowerSync
framework as dynamically linked in the XCode project settings. This seems to be a limitation with XCode's SPM integration.The Fix
The current fix is to add an explicit
PowerSyncDynamic
library product which forces dynamic linking when added. Adding this to an Xcode project restores the preview functionality without the need for enabling the legacy preview mode.This product has been configured for out PowerSync example demo. The screen previews now function for our demo.