I have a Swift class:
class MyTextField : NSObject, UITextFieldDelegate {
var myField: UITextField
// no idea how to pass in my UITextField from Objective-C code
init (x: UITextField) {
myField = x;
}
}
I have added a property (not shown) so I could set myField, and everything is working.
Would like to use the init function, if only the syntax were not a complete mystery. Any ideas?
Call it the same way you'd call an Obj-C initializer, so for your example, you'd call [[MyTextField alloc] initWithX:theTextField];
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.