evgenyneu / Cosmos

A star rating control for iOS/tvOS written in Swift
MIT License
2.18k stars 367 forks source link

Type 'UIAccessibilityTraits' (aka 'UInt64') has no member 'adjustable' #130

Open Faizulkarim opened 5 years ago

Faizulkarim commented 5 years ago

Please consider submitting the following information (if relevant):

Faizulkarim commented 5 years ago

Library setup method: f CocoaPods Version of the library. current Xcode version: 9.4

evgenyneu commented 5 years ago

@Faizulkarim, the current version of the library was updated for the newer version of Swift and Xcode 10. Try version 16, as described here.

DarisMathew commented 5 years ago

Library setup method: manual version of Library: current(Downloaded from github) xcode: 10.1 ios version: 12.1.2

Instead of UIAccessibilityTraits.adjustable :UIAccessibilityTraits.none, i tried UIAccessibilityTraitAdjustable and UIAccessibilityTraitNone

evgenyneu commented 5 years ago

@DarisMathew, thanks for reporting the issue. Did you change UIAccessibilityTraits.adjustable to UIAccessibilityTraitAdjustable and it worked? What is 'Swift Language Version" setting in the Build Settings of your target? The current UIAccessibilityTraits.adjustable syntax is for Swift 4.2.

DarisMathew commented 5 years ago

hello Evgenii,

yeah it worked that way and you are right i was using the version 4 and not 4.2! Thanks for your response.

On Thu, Feb 21, 2019 at 8:54 AM Evgenii Neumerzhitckii < notifications@github.com> wrote:

@DarisMathew https://github.com/DarisMathew, thanks for reporting the issue. Did you change UIAccessibilityTraits.adjustable to UIAccessibilityTraitAdjustable and it worked? What is 'Swift Language Version" setting in the Build Settings of your target? The current UIAccessibilityTraits.adjustable syntax is for Swift 4.2.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/evgenyneu/Cosmos/issues/130#issuecomment-465847300, or mute the thread https://github.com/notifications/unsubscribe-auth/AbeHdDRmyMLzcwS7vtv-dDjvAEdIV67rks5vPhF7gaJpZM4Zb4Fs .

-- Best Regards, Daris Mathew J.

LanceSamaria commented 5 years ago

I went to Build Settings and checked the Swift version which was set at 4.2

I had errors on this line:

view.accessibilityTraits = settings.updateOnTouch ? UIAccessibilityTraits.adjustable :UIAccessibilityTraits.none

I had to change it to:

view.accessibilityTraits = settings.updateOnTouch ? UIAccessibilityTraitAdjustable :UIAccessibilityTraitNone

evgenyneu commented 5 years ago

Thanks, @LanceSamaria. That's weird, UIAccessibilityTraits.adjustable should work fine in Swift 4.2 and 5.0. For which target was the Swift Language Version set to 4.2? There can be multiple targets in one project, and they can have different Swift Language Version settings.

Also, if you are using CocoaPods, check the targets of the Pods project as well.

LanceSamaria commented 5 years ago

@evgenyneu hi, thanks for the response. If there are multiple targets how do I check the one you want me to check on?

Btw that wasn't the only error, I also had a problem on this line:

imageLayer.contentsGravity = CALayerContentsGravity.resizeAspect and the error was:

Screen Shot 2019-04-03 at 5 52 38 PM

To fix I followed this answer: https://stackoverflow.com/a/53444498/4833705

imageLayer.contentsGravity = kCAGravityResizeAspect Now the error is gone:

Screen Shot 2019-04-03 at 5 53 24 PM

evgenyneu commented 5 years ago

hi, thanks for the response. If there are multiple targets how do I check the one you want me to check on?

Click a target, go to "Build Settings" and check the Swift Language Version for this target:

xcode_targets

imageLayer.contentsGravity = kCAGravityResizeAspect Now the error is gone:

That's fine, it looks like you used Swift 3 syntax before.

LanceSamaria commented 5 years ago

@evgenyneu Your correct it was set at 4.0 and my main project actually uses 4.2

Screen Shot 2019-04-03 at 6 04 16 PM

LanceSamaria commented 5 years ago

@evgenyneu now that I set it to 4.2 the original settings work fine.

Thanks for teaching me something new :) :) :)

Maybe you should highlight the fact that after people download your pod they should check the pod's target and make sure the Swift language version matches the main projects Swift language version. I read a couple of other posts that had similar problems to what I had

evgenyneu commented 5 years ago

@LanceSamaria, no worries

aybe you should highlight the fact that after people download your pod they should check the pod's target and make sure the Swift language version matches the main projects Swift language version.

Thanks for advice. I though CocoaPods would set the Swift Language Version automatically for the library target on install. What version of CocoaPods are you using pod --version?

tommyaja commented 5 years ago

Hi @evgenyneu, I use Xcode version 10.2.1, swift 5.0, pod version 1.6.1, and the Cosmos library version 19.0.3, but I still get error:

Screen Shot 2019-08-02 at 15 04 27

although Cosmos Target, I've set it to swift 4.2:

Screen Shot 2019-08-02 at 15 28 20

I've clean and build but still get this error. Am I miss something?

evgenyneu commented 5 years ago

@tommyaja, the settings look right to me, it should work. No idea, sorry. You can try using Swift 5.0 instead, if it helps.

MarquelH commented 4 years ago

Found what I needed here to fix the errors after installing the Cosmos pod.

Thx 👍