1

I'm converting my iOS Project from Swift 2.2 to Swift 3. Everything was going well, but when I tried to set image to an instance of ASImageNode, I got an error that said: "Cannot assign to property: 'image' is a get-only property".

Here is my code:

let imageNode = ASImageNode()
imageNode.image = myImage

However, it worked in Xcode 7 + Swift 2.2.

I checked the definition of the image by 'cmd+click', but Xcode brought me to the -(CIImage *)image; in CIImageAccumulator.h instead of image in ASImageNode.

I could access other class and property in AsyncDisplayKit properly but ASImageNode.image. If I commented all lines with accessing ASImageNode.image, my project was built successfully.

mrfour
  • 1,128
  • 12
  • 21
  • Which version of `AsyncDisplayKit` did you use? I'm using Swift 3 in Xcode 8.2.1, `AsyncDisplayKit` version `2.0.1` and everything work well. – t4nhpt Jan 17 '17 at 02:47
  • I'm also using Swift 3 in Xcode 8.2.1, `AsyncDisplayKit` is `2.0.1`. I have another project as the same, and the project also works well. So it drives me crazy... – mrfour Jan 17 '17 at 03:15
  • So try clean project and rebuild. When I `Cmd + click` the `ASImageNode`, it navigates me to the Swift code, not Objective C code like you showed – t4nhpt Jan 17 '17 at 03:32
  • I have tried clean project, clean build folder, reinstall pods, delete DerivedData folder, and reboot my mac but with no luck. Xcode also navigates me to the definition in ASImageNode.swift by `cmd+click` on the ASImageNode and other properties of it's instance, such as `isCropEnabled`, `cropRect`... But not work on `image` – mrfour Jan 17 '17 at 03:42
  • 1
    what if you set a breakpoint before where you assign to image and try to `po imageNode.image`? – Anton Strogonoff Jan 17 '17 at 11:07
  • I eventually found that I declared an computed instance properties var image: UIImage in extension ASDisplayNode to get a node's snapshot. But there is already a duplicated declaration in ASImageNode, and Xcode 8 didn't warn me about this. – mrfour Feb 19 '17 at 03:38

2 Answers2

0

the solution that worked for me is updating this library .. just update all dependencies that use UIImage , it looks like there's no other solution.

DeyaEldeen
  • 10,847
  • 10
  • 42
  • 75
0

"var imageee:UIImage?"

Initialize by this Hope Worked for you solved my problem by this way

M Hamayun zeb
  • 448
  • 4
  • 10