diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml index 52dbf5e..f13117d 100644 --- a/.github/workflows/build_and_test.yaml +++ b/.github/workflows/build_and_test.yaml @@ -16,9 +16,9 @@ jobs: xcode-version: latest-stable - name: Build and Test run: | - xcodebuild test -scheme PowerSync -destination "platform=iOS Simulator,name=iPhone 16" - xcodebuild test -scheme PowerSync -destination "platform=macOS,arch=arm64,name=My Mac" - xcodebuild test -scheme PowerSync -destination "platform=watchOS Simulator,arch=arm64,name=Apple Watch Ultra 2 (49mm)" + xcodebuild test -scheme PowerSync-Package -destination "platform=iOS Simulator,name=iPhone 16" + xcodebuild test -scheme PowerSync-Package -destination "platform=macOS,arch=arm64,name=My Mac" + xcodebuild test -scheme PowerSync-Package -destination "platform=watchOS Simulator,arch=arm64,name=Apple Watch Ultra 2 (49mm)" buildSwift6: name: Build and test with Swift 6 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f92db5..a7cd300 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * *Potential Breaking Change*: Attachment helpers have been updated to better support Swift 6 strict concurrency checking. `Actor` isolation is improved, but developers who customize or extend `AttachmentQueue` will need to update their implementations. The default instantiation of `AttachmentQueue` remains unchanged. `AttachmentQueueProtocol` now defines the basic requirements for an attachment queue, with most base functionality provided via an extension. Custom implementations should extend `AttachmentQueueProtocol`. +* Added `PowerSyncDynamic` product to package. Importing this product should restore XCode preview functionality. * [Internal] Instantiate Kotlin Kermit logger directly. * [Internal] Improved connection context error handling. diff --git a/Demo/PowerSyncExample.xcodeproj/project.pbxproj b/Demo/PowerSyncExample.xcodeproj/project.pbxproj index 76e7d01..cbe2645 100644 --- a/Demo/PowerSyncExample.xcodeproj/project.pbxproj +++ b/Demo/PowerSyncExample.xcodeproj/project.pbxproj @@ -39,8 +39,9 @@ B666587C2C63B88700159A81 /* SwiftUINavigationCore in Frameworks */ = {isa = PBXBuildFile; productRef = B666587B2C63B88700159A81 /* SwiftUINavigationCore */; }; B69F7D862C8EE27400565448 /* AnyCodable in Frameworks */ = {isa = PBXBuildFile; productRef = B69F7D852C8EE27400565448 /* AnyCodable */; }; B6B3698A2C64F4B30033C307 /* Navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = B6B369892C64F4B30033C307 /* Navigation.swift */; }; - B6FFD5322D06DA8000EEE60F /* PowerSync in Frameworks */ = {isa = PBXBuildFile; productRef = B6FFD5312D06DA8000EEE60F /* PowerSync */; }; BE2F26EC2DA54B2F0080F1AE /* SupabaseRemoteStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2F26EB2DA54B2A0080F1AE /* SupabaseRemoteStorage.swift */; }; + BEDBE19C2E5F0299004E1AB5 /* PowerSyncDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = BEDBE19B2E5F0299004E1AB5 /* PowerSyncDynamic */; }; + BEDBE19D2E5F0299004E1AB5 /* PowerSyncDynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = BEDBE19B2E5F0299004E1AB5 /* PowerSyncDynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; BEE4708B2E3BBB2500140D11 /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = BEE4708A2E3BBB2500140D11 /* Secrets.swift */; }; /* End PBXBuildFile section */ @@ -51,6 +52,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( + BEDBE19D2E5F0299004E1AB5 /* PowerSyncDynamic in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -120,11 +122,11 @@ B66658772C63B7BB00159A81 /* IdentifiedCollections in Frameworks */, B69F7D862C8EE27400565448 /* AnyCodable in Frameworks */, B666587C2C63B88700159A81 /* SwiftUINavigationCore in Frameworks */, - B6FFD5322D06DA8000EEE60F /* PowerSync in Frameworks */, 6A9669022B9EE69500B05DCF /* Supabase in Frameworks */, 6A9669002B9EE4FE00B05DCF /* PostgREST in Frameworks */, 6A9668FE2B9EE4FE00B05DCF /* Auth in Frameworks */, B666587A2C63B88700159A81 /* SwiftUINavigation in Frameworks */, + BEDBE19C2E5F0299004E1AB5 /* PowerSyncDynamic in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -487,7 +489,7 @@ B66658792C63B88700159A81 /* SwiftUINavigation */, B666587B2C63B88700159A81 /* SwiftUINavigationCore */, B69F7D852C8EE27400565448 /* AnyCodable */, - B6FFD5312D06DA8000EEE60F /* PowerSync */, + BEDBE19B2E5F0299004E1AB5 /* PowerSyncDynamic */, ); productName = PowerSyncExample; productReference = 6A7315842B9854220004CB17 /* PowerSyncExample.app */; @@ -885,10 +887,10 @@ package = B69F7D842C8EE27300565448 /* XCRemoteSwiftPackageReference "AnyCodable" */; productName = AnyCodable; }; - B6FFD5312D06DA8000EEE60F /* PowerSync */ = { + BEDBE19B2E5F0299004E1AB5 /* PowerSyncDynamic */ = { isa = XCSwiftPackageProductDependency; package = 18F30B282CCA4B3B00A58917 /* XCLocalSwiftPackageReference "../../powersync-swift" */; - productName = PowerSync; + productName = PowerSyncDynamic; }; /* End XCSwiftPackageProductDependency section */ }; diff --git a/Demo/PowerSyncExample/Screens/HomeScreen.swift b/Demo/PowerSyncExample/Screens/HomeScreen.swift index 8ad4437..640759b 100644 --- a/Demo/PowerSyncExample/Screens/HomeScreen.swift +++ b/Demo/PowerSyncExample/Screens/HomeScreen.swift @@ -33,5 +33,6 @@ struct HomeScreen: View { NavigationStack{ HomeScreen() .environment(SystemManager()) + .environment(NavigationModel()) } } diff --git a/Demo/PowerSyncExample/Screens/SignInScreen.swift b/Demo/PowerSyncExample/Screens/SignInScreen.swift index 4102f2e..5ce09c8 100644 --- a/Demo/PowerSyncExample/Screens/SignInScreen.swift +++ b/Demo/PowerSyncExample/Screens/SignInScreen.swift @@ -78,5 +78,6 @@ struct SignInScreen: View { NavigationStack { SignInScreen() .environment(SystemManager()) + .environment(NavigationModel()) } } diff --git a/Demo/PowerSyncExample/Screens/SignUpScreen.swift b/Demo/PowerSyncExample/Screens/SignUpScreen.swift index 4d039f1..cbc16e5 100644 --- a/Demo/PowerSyncExample/Screens/SignUpScreen.swift +++ b/Demo/PowerSyncExample/Screens/SignUpScreen.swift @@ -78,5 +78,6 @@ struct SignUpScreen: View { NavigationStack { SignUpScreen() .environment(SystemManager()) + .environment(NavigationModel()) } } diff --git a/Package.swift b/Package.swift index d8f589b..5fe4db7 100644 --- a/Package.swift +++ b/Package.swift @@ -61,6 +61,16 @@ let package = Package( .library( name: packageName, targets: ["PowerSync"] + ), + .library( + name: "\(packageName)Dynamic", + // The default value normally specifies that the library is compatible with both static and dynamic linking, + // where the value used is typically specified by the consumer - which is usually defaulted to static linking. + // It's not straight forward to configure the linking option used by XCode consumers - specifying + // this additional product allows consumers to add it to their project, forcing dynamic linking. + // Dynamic linking is particularly important for XCode previews. + type: .dynamic, + targets: ["PowerSync"] ) ], dependencies: conditionalDependencies, diff --git a/README.md b/README.md index 730a12c..58423e1 100644 --- a/README.md +++ b/README.md @@ -80,3 +80,13 @@ For more details, see the [Swift SDK reference](https://docs.powersync.com/clien ## Attachments See the attachments [README](./Sources/PowerSync/attachments/README.md) for more information. + +## XCode Previews + +XCode previews currently fail to load in a reasonable time after adding PowerSync to an XCode project. XCode requires dynamic linking for previews. This is enabled by enabling `ENABLE_DEBUG_DYLIB` in the XCode project. It seems like the previews fail to load due to PowerSync providing a `binaryTarget` which is linked statically by default. + +XCode previews can be enabled by either: + +Enabling `Editor -> Canvas -> Use Legacy Previews Execution` in XCode. + +Or adding the `PowerSyncDynamic` product when adding PowerSync to your project. This product will assert that PowerSync should be dynamically linked, which restores XCode previews. \ No newline at end of file