ra1028 / DiffableDataSources

💾 A library for backporting UITableView/UICollectionViewDiffableDataSource.
https://ra1028.github.io/DiffableDataSources
Apache License 2.0
845 stars 68 forks source link

We're unable to build in Release mode but you have a change on `master` that fixes the issue #21

Open craigomac opened 4 years ago

craigomac commented 4 years ago

Checklist

Expected Behavior

We should be able to build in Release mode.

Current Behavior

In Xcode 11.4 only, building the framework in Release mode fails. The error is in SnapshotStructure.swift on line 38: the compiler complains that it resolves Collection to SnapshotStructure.Section.Collection and that this type has no associated Element.

Detailed Description (Include Screenshots)

The change already made on master to Swift.Collection resolves this issue, but it's not yet in a release.

Please can you make a new release including this change?

Environment

5.0

12.1/13.4

11.4

Any

1.9.0.beta.2 (issue also occurs with latest SPM release)

philippb commented 4 years ago

Same here

Screen Shot 2020-04-06 at 6 24 02 PM
bobek-balinek commented 4 years ago

Oh, it looks like It's not just me that has experienced this issue then!

I have found a working solution to this, which is simply adding a namespace to the Collection type. I'm assuming whatever changes that went to the latest Swift compiler prevent it from making sense of this particular generic constraint.

Changing this:

init<C: Collection>(source: Section, elements: C) where C.Element == Item {

into:

init<C: Swift.Collection>(source: Section, elements: C) where C.Element == Item {

has resolved this issue for me (for both Debug and Release scheme).

I'm happy to provide a PR that fixes this.

craigomac commented 4 years ago

The change to fix this is already on the master branch of this project. All that needs to happen is for the maintainer to make a release, and we'll be able to compile again using that release as a dependency.

For now, we've resolved it in our app by depending directly on the master branch of this GitHub repo (you can do this from Xcode if you're using SPM or from CocoaPods with a branch argument on the pod dependency).

bobek-balinek commented 4 years ago

Noted, I've been using my own fork for a while and I haven't noticed changes to the master branch - hopefully a release will follow.

hernangonzalez commented 4 years ago

+1 any news on releasing master @craigomac ?

ra1028 commented 4 years ago

Sorry for everyone, I completely forget to make a new release 🙏 I will make a new tag, right now

ra1028 commented 4 years ago

new tag and pod released. https://github.com/ra1028/DiffableDataSources/releases/tag/0.4.0

absoftware commented 4 years ago

Yes, I used

pod 'DiffableDataSources', '0.4.0'

but

pod install --repo-update

is required to detect new version. Otherwise I was getting error:

[!] CocoaPods could not find compatible versions for pod "DiffableDataSources":
  In Podfile:
    DiffableDataSources (= 0.4.0)

None of your spec sources contain a spec satisfying the dependency: `DiffableDataSources (= 0.4.0)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.