Wayne Filkins Wayne Filkins - 6 months ago 32
iOS Question

AsyncDisplayKit calculateLayoutThatFits() function works in 1 project, not in another

I'm doing this asyncDisplayKit tutorial for a collection view of images.


I can run the finished project and everything works fine. I copied all the code exactly the same into another project which I am combining multiple tutorials. For some reason I get 1 error. This is odd since it includes every file and I copied and pasted them all perfectly. This is where I get the error:

override func calculateLayoutThatFits(constrainedSize: ASSizeRange) -> ASLayout {
return ASLayout(layoutableObject: self, size: nodeSize)

The error says that the layout arguments should be layout and position, but if I change it then it can't use self as the layout. Anyone know what is going on here?


Swift 3.0

Please try this. This function works for my project.

override func calculateLayoutThatFits(_ constrainedSize: ASSizeRange) -> ASLayout {
   return ASLayout(layoutableObject: self, constrainedSizeRange: ASSizeRangeMake(nodeSize, nodeSize), size: nodeSize)