Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken release builds – misconfigured SwiftUI dependency #59

Open
t0rst opened this issue Feb 7, 2020 · 11 comments
Open

Broken release builds – misconfigured SwiftUI dependency #59

t0rst opened this issue Feb 7, 2020 · 11 comments

Comments

@t0rst
Copy link

t0rst commented Feb 7, 2020

Describe the bug
Since v5.0.0 DynamicColor.framework does not build in release, so breaking release build of host apps. Reproducible in your own demo app.

To Reproduce
Steps to reproduce the behavior:

  1. Open DynamicColorExample.xcodeproj in Xcode 11.3
  2. Select target iOSExample + Generic iOS Device
  3. Build
  4. Build of DynamicColor.framework fails with error:
~/Dev/External/Graphics/DynamicColor/Sources/SwiftUIColor.swift:30:18: error: use of undeclared type 'Color'
public extension Color {

Expected behavior
build does not fail

Smartphone (please complete the following information):
any

Additional context
Suspect this is because the framework is not declaring correct dependency on SwiftUI.framework - needs to be added as optional linked framework.
This is problematic for projects that do not want to introduce dependency on SwiftUI.
Would also help if you could split your podspec into a basic that excludes SwiftUIColor.swift and a subspec that adds it for those who need it; still leaves Carthage users in a bind. Alternatively, duplicate your targets to provide with & without SwiftUI versions of the frameworks. (No plans here to adopt SwiftUI until its well past version 2.)

@t0rst t0rst changed the title Breaking release builds (Problematic SwiftUI dependency) Broken release builds – misconfigured SwiftUI dependency. Feb 7, 2020
@t0rst t0rst changed the title Broken release builds – misconfigured SwiftUI dependency. Broken release builds – misconfigured SwiftUI dependency Feb 7, 2020
@t0rst
Copy link
Author

t0rst commented Feb 7, 2020

Untitled 35

t0rst added a commit to t0rst/DynamicColor that referenced this issue Feb 10, 2020
@t0rst
Copy link
Author

t0rst commented Apr 4, 2020

For anyone suffering from this, I did a temporary fork to work around it → this added to my podfile:

# pod 'DynamicColor', '~> 5'
# ...latest podspec not yet pushed to CocoaPods/Specs.git..
# pod 'DynamicColor', :git => 'https://github.com/yannickl/DynamicColor.git', :tag => '5.0.0'
# ...5.0.0 will not build in release - https://github.com/yannickl/DynamicColor/issues/59 - so..
  pod 'DynamicColor', :git => 'https://github.com/t0rst/DynamicColor.git', :tag => '5.0.1'

@richardgroves
Copy link
Contributor

Thanks for creating the fork @t0rst - saved me when I hit this same problem.

I've be able to get the original repo working by bumping up all the deployment targets to latest (ie SwiftUI compatible) versions. It would seem the @available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *) at line 29 of SwiftUIColor.swift isn't working to exclude the extension during release builds. [My projects deployment target is iOS 13.4 so that shouldn't be a problem]

@richardgroves
Copy link
Contributor

Further experimenting and I can get it to build by just adjusting the iOS Deployment version to 11.0 on the DynamicColor and iOSExample targets. But I haven't tried Mac/TvOS/Watch builds.

@richardgroves
Copy link
Contributor

I have a fork of DynamicColor at https://github.com/NoodlFroot/DynamicColor that has raised the deployment target for iOS to 11.0 and now does build for iOS release configurations at least.

I'll test some more and make a pull request when happy all is ok.

@guidedways
Copy link

guidedways commented May 16, 2020

@richardgroves your fork hasn't worked for me, when trying to build for "Profile", I get the same build error (using Swift PM)

@richardgroves
Copy link
Contributor

richardgroves commented May 16, 2020

Hi @guidedways - I'm not seeing this. If I build the DynamicColor iOSExample for profile it is fine, and building my project that depends on this for Profile is fine.

I'm targeting the iPad Air (3rd generation) (13.4.1) simulator and same with iPad Pro 12.9 (iOS 13.4.1) and iPhone X (iOS 13.3.1)

What is the target device / simulator of you project? Does it build ok for the 'Generic iOS Device' target?

Can you show the SwiftPM Settings used?

@richardgroves
Copy link
Contributor

@guidedways - ok, I've managed to reproduce the problem on my project that includes it via a SwiftPM dependency - before it was using a stale cache version that didn't use my fork. I'll look into why it works differently in SwiftPM dependency from the Example xcode project.

@richardgroves
Copy link
Contributor

Ok @guidedways - fixed it (I hope...!)

I had to add platforms: [.iOS(SupportedPlatform.IOSVersion.v11)] to the DynamicColour package file to limit it to iOS 11 - it seems SwiftPM will build the packages for a lower version even if the final project including it has a higher version.

.package(url: "https://github.com/NoodlFroot/DynamicColor", from: "5.0.2") should give you a good dependency.

@richardgroves
Copy link
Contributor

Update Pull request has been created that fixes the swift package version as well as CocoaPods.

@grgar
Copy link

grgar commented Jun 29, 2023

Fixed in #63, please close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants