Skip to content

Breaks SwiftUI previews in a project with cocoapods #56

@gerchicov-vg

Description

@gerchicov-vg

Description

I added this library via SPM. Then I added cocoapods (most of these libraries are not available via SPM):

   pod 'Google-Mobile-Ads-SDK'
   pod 'GoogleUserMessagingPlatform'
   pod 'GoogleMobileAdsMediationMintegral'
   pod 'GoogleMobileAdsMediationVungle'
   pod 'GoogleMobileAdsMediationPangle'
   
   pod 'AppLovinSDK'
   pod 'AppLovinMediationVungleAdapter'
   pod 'AppLovinMediationUnityAdsAdapter'
   pod 'AppLovinMediationGoogleAdapter'
   pod 'AppLovinMediationMintegralAdapter'
   pod 'AppLovinMediationIronSourceAdapter'
   pod 'AppLovinMediationFacebookAdapter'
   pod 'AppLovinMediationGoogleAdManagerAdapter'
   pod 'AppLovinMediationFyberAdapter'
   pod 'AppLovinMediationByteDanceAdapter'
   pod 'AppLovinMediationCSJAdapter'

Result - previews are broken because of a lot of errors with sharing-grdb:
Image

I don't know how to fix it but I tried different combinations:
1)project + SharingGRDB only
2)then added cocoapods
3)then removed SharingGRDB
4)another project + cocoapods only (the same cocoapods)
5)examples from this repo

Previews work in every project except of the case I add SharingGRDB and cocoapods simultaneously. SharingGRDB also sometimes fails to compile with random errors so it seems to be a reason of all the problems.
I can't reproduce it with examples from this repo because they already contain workspace file and so I don't know how to add cocoapods there.

I have also tried to add GRDB separately - it works.

NOTE: Previews don't work even in screens where I didn't import SharingGRDB. And in the main project I intentionally moved SharingGRDB into a separate file and didn't use its features like @Dependency directly in screens to prevent additional problems.

Checklist

  • I have determined whether this bug is also reproducible in a vanilla SwiftUI project.
  • I have determined whether this bug is also reproducible in a vanilla GRDB project.
  • If possible, I've reproduced the issue using the main branch of this package.
  • This issue hasn't been addressed in an existing GitHub issue or discussion.

Expected behavior

SwiftUI previews work with SharingGRDB and cocoapods added to the same project. Or at least SharingGRDB is disabled for previews to avoid these problems

Actual behavior

Each preview fails to render

Reproducing project

test-sharingGRDB.zip

SharingGRDB version information

0.2.2

Sharing version information

2.5.2

GRDB version information

7.5.0

Destination operating system

and iOS simulator

Xcode version information

16.2

Swift Compiler version information

Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-darwin24.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions