I'm working on a mixed Objective-C and Swift project.
I have a class named Point
, defined in Objective-C, which has int
properties and an initializer:
@property (nonatomic) int column;
@property (nonatomic) int row;
- (id) initWithColumn:(int)column row:(int)row;
which I use to create an object in a Swift file:
Point(column: Column, row: Row)
But it gives an error:
cannot invoke 'init' with an argument list with type '(column: Int, row: Int)'
By checking further, I found out that these int
properties in Objective-C become Int32
in Swift, and Int32
cannot be converted to Int
.
Does anyone know how to fix this?
I wonder how comes that Objective C int becomes Int32 in Swift and how to deal with this so that I can have Int type in Swift from Objective C? I use this class frequently and prefer to keep the type consistent instead of casting each time.