3 ms·
Ok, `NSImage initWithContentsOfURL` is awesome. I haven't ever done much GUI coding, is that a standard type of thing in GUI toolkits? (also, the pedant in me
by zrail 12y ago
Ok, `NSImage initWithContentsOfURL` is awesome. I haven't ever done much GUI coding, is that a standard type of thing in GUI toolkits?
(also, the pedant in me would like to point out that this is not "shell scripting" as you're not scripting a shell, but it's super cool regardless)
- melling 12y agoShell scripting usually means writing in your shells (e.g sb, csh, zsh) native script. The author is using it to mean small scripts that he runs in a shell, which is fine with me. I'm starting to use Go for these sorts of things because it's really fast. I'd try objc but if I want to move my programs to a Linux server, I'm out of luck.
- wtallis 12y agoYou're not out of luck when it comes to using objc on linux, you just have to forgo a lot of the newer APIs. But if you're using it on a server, chances are you won't miss the GUI APIs that GNUstep lacks.
- mrsteveman1 12y agoIndeed, I had an entire server blog engine written in objc, I had it running quite well on a Mac VPS (Lion running on vmware on Xserves), that I intended to move over to a Linode. But I wanted libdispatch, blocks, all the stuff in the newer objc runtime, etc. Back then that meant playing all sorts of games compiling a specific objc runtime (there's more than one outside of apple), in a specific order with other things from GNUstep, using clang at certain steps instead of gcc to compile it all. It was a mess, but if I had really wanted to I probably could have pulled it off, and now I'm sure things have improved. I moved the entire thing to python and forgot about it though. But I've always liked the idea of writing little things that have no GUI of any kind in objc, I wrote a few commandline utilities in objc and loved it. Background services on the system (mac or linux either one) would be fun too I think.
- 21echoes 12y agoTo be a bit pedantic: NSImage isn't part of a GUI toolkit -- don't confuse NSImage with UIImageView! The NSImage is more equivalent to a .png, not to a web <img> tag; it's completely separate from a framework for routing data to the screen.
- demallien 12y agoAre you sure about that? I'm pretty sure that it's NSImage that holds the actual pixmap, which definitely makes it part of the GUI stack.
- Moto7451 12y agoNSImage is part of AppKit and while it is definitely key to a lot of UI code that's because of well thought out delegation rather than it being part of UIKit or CocoaTouch. It would be pretty annoying to have two different and possibly incompatible NSImage classes to deal with if it lived in each platform's UI framework.
- DHowett 12y agoUnfortunately, UIKit doesn't use the well-thought-out NSImage class, opting instead to reimplement it by way of UIImage. In this case, the GP is correct: NSImage is part of the UI toolkit (AppKit); it is not a core API exposed by, say, Foundation.