How to create a Swift object in Objective-C? -


if define swift class this

@objc class cat {  } 

in swift can do

var c = cat() 

but how make cat instance in objective-c ?

subclassing nsobject works because can "alloc-init" can achieve without subclassing objective-c class?

the direct way subclass cat nsobject. if can't that, need make class method or function returns cat.

@objc class cat {     class func create() -> cat {         return cat()     } } func createcat() -> cat {     return cat() }   cat *cat = [cat create]; cat *cat = createcat(); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -