You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into a small problem while setting up a new project, I've used BonMot before, with success. However, now I installed it through CocoaPods, and my codebase won't compile anymore:
--
Running Xcode 9, project is Swift 3.2.
From my podfile: pod 'BonMot'
Is there perhaps a mistake I made in using Swift 3.2? Perhaps I'm supposed to use a legacy version?
As you guessed, this appears to be an issue with Swift 3.2. As of BonMot 5.0, Swift 3.x is no longer supported. I tried, but it was too hard to get NSAttributedStringKey to play nice with both versions.
The good news is that you shouldn't have to build your whole project in Swift 4 just to use BonMot. I may be wrong about this, but I believe that if you're using CocoaPods 1.4 or later, it will respect the swift_version flag from the podspec and build BonMot as Swift 4.
Please give this a try, and let me know if it doesn't work. I foresee a potential problem, because BonMot's public interface includes references to NSAttributedStringKey, and since that isn't available in Swift 3.2, you could still run into a problem.
If that's the case, I'd ask if it's an option to update your project to Swift 4? If you have Swift 3.2 dependencies, there are workarounds for that available as well, but let's see how far you get with the above suggestions first.
🤔 hmm, on more careful reading, it looks like you are in fact building BonMot as Swift 4 in a Swift 3.2 project, and NSAttributedStringKey is indeed causing problems. So before we try to debug further, I'd like to know whether updating your main project to Swift 4 is an option?
Activity
SenorWesley commentedon Feb 28, 2018
Referenced the answer from this issue: #317 (comment) that I submitted a month ago. This resulted in the following:
Error log:
ZevEisenberg commentedon Feb 28, 2018
Hey, @SenorWesley. Thanks for using BonMot!
As you guessed, this appears to be an issue with Swift 3.2. As of BonMot 5.0, Swift 3.x is no longer supported. I tried, but it was too hard to get
NSAttributedStringKeyto play nice with both versions.The good news is that you shouldn't have to build your whole project in Swift 4 just to use BonMot. I may be wrong about this, but I believe that if you're using CocoaPods 1.4 or later, it will respect the
swift_versionflag from the podspec and build BonMot as Swift 4.Please give this a try, and let me know if it doesn't work. I foresee a potential problem, because BonMot's public interface includes references to
NSAttributedStringKey, and since that isn't available in Swift 3.2, you could still run into a problem.If that's the case, I'd ask if it's an option to update your project to Swift 4? If you have Swift 3.2 dependencies, there are workarounds for that available as well, but let's see how far you get with the above suggestions first.
ZevEisenberg commentedon Feb 28, 2018
🤔 hmm, on more careful reading, it looks like you are in fact building BonMot as Swift 4 in a Swift 3.2 project, and
NSAttributedStringKeyis indeed causing problems. So before we try to debug further, I'd like to know whether updating your main project to Swift 4 is an option?ZevEisenberg commentedon Mar 29, 2018
@SenorWesley were you able to get your project compiling?