On 19 Oct 2014, at 2:43 pm, Rick Mann <rm...@latencyzero.com> 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).

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to