NSTextField or NSTextView?

Could someone explain to me what are the main differences between NSTextField and NSTextView? I know that NSTextView has more features and is usually used for longer texts, and NSTextField is usually used for one-line plain text fields, but if I understand correctly, NSTextField can be also used with attributed strings and with multiple lines… … Read more

How well is Objective-C++ supported?

Disclaimer: I don’t work or speak for Apple, so this is my opinion: I can’t speak for the major dev shops, but in my small group, we’ve used Objective-C++ both for integrating C++ libraries, and as you propose for writing backends in C++. As @alxp mentions, things like exception handling across the language boundary are … Read more

Subclassing NSWindowController in Swift and init(windowNibName)

Instead of overriding any of the init methods you can simply override the windowNibName property and return a hardcoded string. This allows you to call the basic vanilla init method to create the window controller. class WindowController: NSWindowController { override var windowNibName: String! { return “NameOfNib” } } let windowController = WindowController() I prefer this … Read more

Using frameworks in a command line tool

Unfortunately, there is no way to bundle a framework with a command-line Utility in OS X and I suspect that the framework you’re linking to is expecting to be bundled in the app bundle’s Frameworks/ directory. If you have access to the framework source code, you can compile a static library and statically link it … Read more

How to “pass on” a variable number of arguments to NSString’s +stringWithFormat:

initWithFormat:arguments: NSString *estr(NSString *format, …) { va_list args; va_start(args, format); NSString *s = [[[NSString alloc] initWithFormat:format arguments:args] autorelease]; va_end(args); return s; } they don’t seem to have a convenience constructor “stringWith…” version

Compiler error “expected method not found” when using subscript on NSArray

You’ve got to be compiling with the iOS 6 or OS X 10.8 SDKs — otherwise Foundation objects don’t have the necessary methods for the subscripting bit of the literal syntax.* Specifically in this case, the subscripting expects objectAtIndexedSubscript: to be implemented by NSArray, and that’s a new method that was created to interact with … Read more

CoreFoundation vs Foundation

In a technical sense, yes, it is faster, for exactly that reason. In a practical sense, no, it’s not faster. For one thing, the speed difference is tiny. We’re talking milliseconds saved over the life of the entire process. The savings might be bigger on the iPhone, but it’s still pretty much the tiniest speed … Read more

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