• 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: Rick Mann <email@hidden>
  • Date: Sat, 18 Oct 2014 20:54:48 -0700

> On Oct 18, 2014, at 20:47 , Graham Cox <email@hidden> wrote:
>
>
> On 19 Oct 2014, at 2:43 pm, Rick Mann <email@hidden> wrote:
>
>> 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.
>>
>
>
> Well, I'm not working in Swift so it may not have parity with Obj-C in some ways that I haven't understood, but isn't there a way to just name the class, rather than asking self what it is?
>
> Also, there's no rule about executing code before calling super init, as long as it does not rely on the state of the object being inited. You can certainly call into NSBundle at that time, just not using [self class] (or its Swift equivalent) but [MyClass class] (or its Swift equivalent).

You're probably right about that, but in this case, you wouldn't be able to pass self for owner:


--
Rick Mann
email@hidden



_______________________________________________

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


  • Follow-Ups:
    • Re: bundleForClass in Swift
      • From: Graham Cox <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>)
 >Re: bundleForClass in Swift (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: bundleForClass in Swift
  • Next by Date: NSComboBox in the tab ring
  • Previous by thread: Re: bundleForClass in Swift
  • Next by thread: Re: bundleForClass in Swift
  • Index(es):
    • Date
    • Thread