• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: bundleForClass in Swift
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bundleForClass in Swift


  • Subject: Re: bundleForClass in Swift
  • From: Kevin Meaney <email@hidden>
  • Date: Sun, 19 Oct 2014 11:03:41 +0100

>>
>> I think my other reply will make this a moot point, but since [NSBundle bundleForClass:] takes a Class, and you know what your class is, just pass it that, you don't have to reference self.
>>
>> [NSBundle bundleForClass:[MyGroovySubclass class]];
>
> Sorry, I was conflating Obj-C and Swift syntax. I'm trying to do this all in swift, in which case it's:
>
> 	NSBundle(forClass: self.dynamicType)
>
> But you can't call this in an initializer before calling super init.

Hi Rick,

In my test target to access resources needed by the tests I do:

let testBundle = NSBundle(forClass: MovingImagesFrameworkiOSSwift.self)

Where MovingImagesFrameworkiOSSwift is the Swift class.

Kevin


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >bundleForClass in Swift (From: Rick Mann <email@hidden>)
 >Re: bundleForClass in Swift (From: Graham Cox <email@hidden>)
 >Re: bundleForClass in Swift (From: Rick Mann <email@hidden>)

  • Prev by Date: Trouble binding an NSTextField value in Swift
  • Next by Date: Wiring up MainMenu.xib
  • Previous by thread: Re: bundleForClass in Swift
  • Next by thread: NSComboBox in the tab ring
  • Index(es):
    • Date
    • Thread