Closed rmvz3 closed 9 years ago
Hi,
BezierString does not extend NSObject, which means it is not initialized as one. initWith:
is an object function, and as such doesn't work on unallocated objects.
You can make the BezierString an extension of NSObject
class BezierString : NSObject {
and init it via
[[BezierString alloc] initWithBezierPath:bezierPath];
Or, you can keep it a pure Swift object and add a class level initializer:
@objc class BezierString {
class func bezierStringWithBezierPath(bezierPath: UIBezierPath) -> BezierString {
return BezierString(bezierPath: bezierPath)
}
and init it like this:
[BezierString bezierStringWithBezierPath:bezierPath];
The UIBezierLabel already extends NSObject (because UILabel does), so that works without any modifications.
best regards, luka
Hi Ivnyk.
I should have known that one. :) My swift skills are still very low.
Thanks a lot.
Best
Hi. I can access UIBezierLabel from my Obj-C based app without problem but I can't reach BezierString class.
If I change class declaration as:
@objc class BezierString
I'm able to use the classes and methods like this:but I get an "Unrecognized selector +[MyClass.BezierString initWithBezierPath:]" error.
I know this strictly is not a class issue but I wonder if you could help.
Thanks