Cosmos icon indicating copy to clipboard operation
Cosmos copied to clipboard

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

Open Faizulkarim opened this issue 5 years ago • 15 comments

Please consider submitting the following information (if relevant):

  • Library setup method: file, Carthage, CocoaPods or Swift Package Manager.
  • Version of the library. Example: 8.0.
  • Xcode version. Example: 8.3.3.
  • OS version. Example: iOS 10.3.2.

Faizulkarim avatar Dec 20 '18 10:12 Faizulkarim

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

Faizulkarim avatar Dec 20 '18 10:12 Faizulkarim

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

evgenyneu avatar Dec 20 '18 11:12 evgenyneu

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

DarisMathew avatar Feb 18 '19 09:02 DarisMathew

@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.

evgenyneu avatar Feb 21 '19 03:02 evgenyneu

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 < [email protected]> 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.

DarisMathew avatar Mar 02 '19 04:03 DarisMathew

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

LanceSamaria avatar Apr 03 '19 21:04 LanceSamaria

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.

evgenyneu avatar Apr 03 '19 21:04 evgenyneu

@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

LanceSamaria avatar Apr 03 '19 21:04 LanceSamaria

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.

evgenyneu avatar Apr 03 '19 22:04 evgenyneu

@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 avatar Apr 03 '19 22:04 LanceSamaria

@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

LanceSamaria avatar Apr 03 '19 22:04 LanceSamaria

@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?

evgenyneu avatar Apr 03 '19 22:04 evgenyneu

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?

tommyaja avatar Aug 02 '19 08:08 tommyaja

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

evgenyneu avatar Aug 02 '19 12:08 evgenyneu

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

Thx 👍

MarquelH avatar Oct 31 '19 02:10 MarquelH