Re: Loading image resources

2014-09-14 Thread Charles Jenkins
Well, that explanation was helpful. I learned how to verify that the images.xcassets is indeed included in my target build. Also I tried one of your suggestions, and this is what works: class func getImageAsset( name: String ) -> NSImage { let bundle = NSBundle.mainBundle() let img =

Re: Why not use path-based API? (was: Loading image resources)

2014-09-14 Thread Jens Alfke
Performance is another reason. IIRC, in earlier OS X releases it turned out that there was significant overhead stemming from converting between different types of file references as a call went up and down the stack — NSString/CFString <—>NSURL/CFURL <—> FSRef <—> C strings, etc. (This may soun

Re: Loading image resources

2014-09-14 Thread Quincey Morris
On Sep 14, 2014, at 11:37 , Charles Jenkins wrote: > Okay, here’s a point on which I may need education. Xcode created my project > with an images.xcassets folder right there in it, and that’s where I’m adding > my images. Do you mean that’s not enough? I need to add images.xcassets to > the t

Re: Loading image resources

2014-09-14 Thread Charles Jenkins
Okay, here’s a point on which I may need education. Xcode created my project with an images.xcassets folder right there in it, and that’s where I’m adding my images. Do you mean that’s not enough? I need to add images.xcassets to the target somewhere else? How do I do that? -- Charles Jen

Re: Why not use path-based API? (was: Loading image resources)

2014-09-14 Thread Ken Thomases
On Sep 14, 2014, at 2:57 AM, Aandi Inston wrote: >> No one should be using path-based API any more, generally. >> You should use URL-based equivalents. > > Why? Really, why? Certainly there are APIs where we have to use URL's and > we have to convert the path into a URL, but where a non-deprecat

Re: Why not use path-based API? (was: Loading image resources)

2014-09-14 Thread Jean-Daniel Dupas
Le 14 sept. 2014 à 10:23, Quincey Morris a écrit : > On Sep 14, 2014, at 00:57 , Aandi Inston wrote: > >> Why? Really, why? Certainly there are APIs where we have to use URL's and >> we have to convert the path into a URL, but where a non-deprecated >> path-based URL exists, what current or f

Re: Why not use path-based API? (was: Loading image resources)

2014-09-14 Thread Quincey Morris
On Sep 14, 2014, at 00:57 , Aandi Inston wrote: > Why? Really, why? Certainly there are APIs where we have to use URL's and > we have to convert the path into a URL, but where a non-deprecated > path-based URL exists, what current or future obstacles do you foresee? The > URL doesn't seem to be m

Why not use path-based API? (was: Loading image resources)

2014-09-14 Thread Aandi Inston
> No one should be using path-based API any more, generally. > You should use URL-based equivalents. Why? Really, why? Certainly there are APIs where we have to use URL's and we have to convert the path into a URL, but where a non-deprecated path-based URL exists, what current or future obstacles

Re: Loading image resources

2014-09-13 Thread Quincey Morris
On Sep 13, 2014, at 21:33 , Charles Jenkins wrote: > Of course I meant that the imageFileName returned by the API call is nil. Ah, OK, but you still need to verify that everything is in place. For example, if you forgot to add the asset folder to the target, the image files wouldn’t be in th

Re: Loading image resources

2014-09-13 Thread Charles Jenkins
*Sigh* I seem to make a typo every time I post to this list. Of course I meant that the imageFileName returned by the API call is nil. -- Charles Jenkins On Saturday, September 13, 2014 at 5:12 PM, Quincey Morris wrote: > On Sep 13, 2014, at 12:28 , Charles Jenkins (mailto:cejw...@gmail

Re: Loading image resources

2014-09-13 Thread Quincey Morris
On Sep 13, 2014, at 12:28 , Charles Jenkins wrote: > After calling bundle.pathForResource:ofType:, imageName is nil. I think what > I’m doing is what the Resource Programming Guide says to do. How am I getting > it wrong? a. Yes, but did you check whether bundle or imageFileName is nil? Is im

Loading image resources

2014-09-13 Thread Charles Jenkins
Hi, everyone. In my project’s images.xcassets, I created three image sets with these names: Folder SinglePage MultiPage Each one contains a single PNG image. Now I’m trying to load them into NSImages. Here’s what doesn’t work: let folderImage: NSImage let singleDocumentImage: NSImage l