Swift method with fast enumeration as parameter is not displayed in Objective-C

I have a quick class with an enumeration and a method that expects a parameter with an enumeration type:

import SpriteKit

enum Direction: Int {
    case up = 1;
    case down = -1;
}

class ParallaxScrollingNode: SKNode {

    func addStaticBackground(name: String) {
        ...
    }

    func addParallaxBackground(imageNames: [String], yScaleFactor: CGFloat, yDirection: Direction) {
        ...
    }

In my Objective-C class, you can call the first, but not the second method:

enter image description here

The listing seems to be causing the problem. A method is a rocket if I change the type to Int. Of course, I can do this with my code, but I want to understand if this does not work at all, or if I missed something.

Thanks
Stefan

+1
source share
1 answer

So for someone who has a simillar problem:

adding a specification @objcbefore the declaration makes this structure available in the Objective-C world.

.

+2

Source: https://habr.com/ru/post/1618015/


All Articles