AliSoftware / Reusable

A Swift mixin for reusing views easily and in a type-safe way (UITableViewCells, UICollectionViewCells, custom UIViews, ViewControllers, Storyboards…)
MIT License
3k stars 239 forks source link

What time can support Swift4.0? #50

Closed mqch295 closed 6 years ago

AliSoftware commented 6 years ago

I'm not sure what changes would be needed for Swift 4, it seems to me that Reusable doesn't use anything that changed in Swift 4 that would require a migration, so it should already work in Swift 4 out of the box.

What errors are you seing when using in Swift 4 that would suggest that it isn't compatible?!

muukii commented 6 years ago

@mqch295 @AliSoftware

IMO, I think the framework built by Swift3 will be not compatible caching with Carthage. So, We need to upgrade to Swift4. Thank you.

*** Skipped installing Reusable.framework binary due to the error:
    "Incompatible Swift version - framework was built with 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) and the local version is 4.0 (swiftlang-900.0.65 clang-900.0.37)."
AliSoftware commented 6 years ago

@muukii That's more of a Carthage-related issue (all libraries with a pre-built binary built with Swift 3 will have the same issue). You can just use --no-use-binaries with Carthage to avoid using the pre-built binary. That's the recommended way by Carthage anyway

Given that Swift doesn't have ABI stability yet, it has little sense to provide a pre-built binary — especially during those transitions between Swift versions. If we provide a pre-built Swift 4 binary, users still using Swift 3 (and there are still many people not ready to migrate due to their internal roadmap) will complain, and the same will be true in the opposite direction (I already experienced this kind of war with my other OSS libraries, we can't make everybody happy anyway when having pre-built binaries at least until we have ABI stability in Swift).

So I'll probably not provide a pre-built binary (.framework.zip) in the future releases of Reusable, so that Carthage always builds from Source (and thus is built by Carthage using the Swift version you're currently using in your project). And for the current release, for people using Swift 4 you can simply use --no-use-binaries

muukii commented 6 years ago

@AliSoftware Okay. Thanks. Currently, If we want to build with Swift4, we should use --no-use-binaries. And, Migrate to Swift 4 when Swift 3's support expires?

AliSoftware commented 6 years ago

@muukii There's nothing to do in Reusable's side to support Swift 4 if I'm not mistaken, as the source code itself is already compatible. The only problem is when you use Carthage and with pre-compiled binaries.

When you use --no-use-binaries, Carthage will compile the Reusable source code itself — so using the Swift 3 mode if you use the Swift 3 compiler, and using Swift 4 mode if you use Swift 4 in your project, and as Reusable can be built both as Swift 3 & Swift 4 it will work in both cases.

muukii commented 6 years ago

@AliSoftware Okay, I understand! Thank you!

floriangbh commented 6 years ago

Hello !

Since Carthage 0.26 I'm not able to build Reusable .. I got the following error :

Failed to write to /Users/*/Documents/App-iOS/*/Carthage/Build/iOS/Reusable.framework: Error Domain=NSCocoaErrorDomain Code=260 "The file “Reusable.framework” couldn’t be opened because there is no such file." UserInfo={NSURL=file:///Users/*/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/Reusable/4.0.1/Build/Intermediates.noindex/ArchiveIntermediates/Reusable-iOS/BuildProductsPath/Release-iphoneos/Reusable.framework, NSFilePath=/Users/*/Library/Caches/org.carthage.CarthageKit/DerivedData/9.0_9A235/Reusable/4.0.1/Build/Intermediates.noindex/ArchiveIntermediates/Reusable-iOS/BuildProductsPath/Release-iphoneos/Reusable.framework, NSUnderlyingError=0x7feb68e14d60 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Even with a clean cache (Carthage & Derived) or with a clean machine. This error occur only with Reusable.

Any idea ?

Thanks

AliSoftware commented 6 years ago

Did you use --no-use-binaries with Carthage to build it as explained above?

Ping @ikesyo any idea?

floriangbh commented 6 years ago

carthage update Reusable --platform iOS --no-use-binaries.

I just tried again with 0.26.1it didn't work. I downgraded to 0.25 and it work again :-)

ikesyo commented 6 years ago

That should be fixed in Carthage 0.26.1. Homebrew formula will be updated soon: https://github.com/Homebrew/homebrew-core/pull/19392.

floriangbh commented 6 years ago

That is fixed in Carthage 0.26.1.

I have already tried (from the .pkg install) with the 0.26.1 and it didn't work.

ikesyo commented 6 years ago

Hmm I understand now that the issue comes from the fact that this project's Carthage support is achived by the CocoaPods-generated xcodeporj file and the project produces frameworks in a different directory from Carthage expectation.

AMatecki commented 6 years ago

@ikesyo is it fixable by Carthage?

floriangbh commented 6 years ago

This is now great with the 0.26.2, thanks !

liowu commented 6 years ago

When pod install, It doesn't work in swift4.0.

AliSoftware commented 6 years ago

@liowu we'll need more info about the error you have to help you.

AliSoftware commented 6 years ago

Closing due to inactivity, and as Swift 4.1 and 4.2 support have been added since then.