• 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: how to centralize functionality more elegantly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to centralize functionality more elegantly?


  • Subject: Re: how to centralize functionality more elegantly?
  • From: James DiPalma <email@hidden>
  • Date: Sat, 7 Sep 2002 13:31:29 -0400

Yeah, I should have said something like that. I was trying to point out one advantage of using a singleton.

If [MainController sharedController] does not return an instance of MainController, you will get a compile time warning. If [NSApp delegate] does not return an instance of MainController, you will get no compile time warning.

Because there is no compile time type checking for [NSApp delegate], you should consider using a run time type check (as Ondra shows below), but your code does not type check at run time (which was my point: this code performs no compile time check nor any run time check to verify that [NSApp delegate] is actually an instance of MainController).

-jim


On Saturday, September 7, 2002, at 01:01 PM, Ondra Cada wrote:


On Saturday, September 7, 2002, at 06:52 , James DiPalma wrote:

there is no compile time or run time check to verify that [NSApp delegate]
actually is a (MainController*)

Ammm... have I overlooked something?

if ([[NSApp delegate] isKindOfClass:[MainController class]]) ...
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: how to centralize functionality more elegantly? (From: Ondra Cada <email@hidden>)

  • Prev by Date: Re: how to centralize functionality more elegantly?
  • Next by Date: Tabbing into NSTableView finally solved!!
  • Previous by thread: Re: how to centralize functionality more elegantly?
  • Next by thread: Drawing text in NSView
  • Index(es):
    • Date
    • Thread