Creating a class that conforms to a protocol

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating a class that conforms to a protocol

TimM-3
I'm struggling to understand how the Protocol browser works. I swear that
once I created a class that conformed to a protocol but now I can't seem to
do it?

In the protocol browser I found a protocol I want to implement (collection).

In the implmeenting classes pane, I right click and select new. I enter the
name of my class, specify a superclass (object) and specify a Package.

I get an error - <Myclass> is not avaialable for browsing.

It has created my class, but it has not method stubs in it.

Along the same lines, if I have an existing class, is there any way to get
method stubs created so it conforms to a specific protocol?

Tim


Reply | Threaded
Open this post in threaded view
|

Re: Creating a class that conforms to a protocol

Blair McGlashan
"TimM" <[hidden email]> wrote in message
news:[hidden email]...

> I'm struggling to understand how the Protocol browser works. I swear that
> once I created a class that conformed to a protocol but now I can't seem
> to do it?
>
> In the protocol browser I found a protocol I want to implement
> (collection).
>
> In the implmeenting classes pane, I right click and select new. I enter
> the name of my class, specify a superclass (object) and specify a Package.
>
> I get an error - <Myclass> is not avaialable for browsing.

This is a bug - the Protocol Browser uses a ClassHierarchySelector component
for 'Conforming Classes' tree with its default view. This has an
inappropriate context menu that contains all the standard class related
commands that you see in a class browser. The 'New' command is just creating
a new class, which doesn't conform to the protocol, and which is not
therefore available for browsing.

You should create the class in a class browser. You can then either use the
Protocol Browser to add the class (this can be done from the menu bar), or
you can just use the Add command on the protocols pane of the class browser
with your new class selected.

>
> It has created my class, but it has not method stubs in it.
>
> Along the same lines, if I have an existing class, is there any way to get
> method stubs created so it conforms to a specific protocol?

Use the Add command on the protocols pane of the class browser, or drag &
drop the protocol from another browser (class or protocol).

Regards

Blair