What is the NSObject isEqual: and hash default function?

As you’ve correctly guessed, NSObject‘s default isEqual: behaviour is comparing the memory address of the object. Strangely, this is not presently documented in the NSObject Class Reference, but it is documented in the Introspection documentation, which states: The default NSObject implementation of isEqual: simply checks for pointer equality. Of course, as you are doubtless aware, … Read more

NSObject description and debugDescription

Technical Note TN2124 Note: print-object actually calls the debugDescription method of the specified object. NSObject implements this method by calling through to the description method. Thus, by default, an object’s debug description is the same as its description. However, you can override debugDescription if you want to decouple these; many Cocoa objects do this. If … Read more

Subclassing NSObject in Swift – Best Practice with Initializers

I’m not Swift ninja but I would write MyClass as: class MyClass: NSObject { var someProperty: NSString // no need (!). It will be initialised from controller init(fromString string: NSString) { self.someProperty = string super.init() // can actually be omitted in this example because will happen automatically. } convenience override init() { self.init(fromString:”John”) // calls … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)