Obj-C Type Encoding question

I’m working on implementing a method on a subclass of NSView and am having trouble getting the type encoding set correctly. If anyone is familiar with this, I’d love some help:

The method I’m implementing is:

- (void)drawRect:(NSRect) dirtyRect;

The encoding I’m currently looking at is:


I’ve also tried


The signature of the Xojo method is:

Shared Sub SharedDrawRect(sender as ptr, sel as ptr, rect as NSRect)

And NSRect is a structure which contains an NSPoint and an NSPoint, both of which contain two CGFloats.

Any thoughts?

In a test here (online, not real machine) I see dd not ff.

2023-03-05 11:07:18.305 a.out[6682:6682] {_NSRect={_NSPoint=dd}{_NSSize=dd}}

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {

    NSLog(@"%s", @encode(NSRect));

    return 0;

They have been doubles since 10.5 but are still floats on watchOS according to the apple docs.

Excellent @Rick_A , could you give me the URL for that tool?

Edit: nm, I found it. Was just challenging on my phone.


Thanks guys. I’ll try this later today.

1 Like

This used to work. Haven’t tried on recent iOS but I assume it’s fine

iOS included?

If I remember correctly, Xojo can’t build watchOS apps.

I questioned iOS, Xojo can build for it. Did iOS also maintain floats?

Gotcha, that wasn’t entirely clear, sorry.

That happens.

I’m really only interested in NSView on macOS at the moment so I think this’ll do what I need. Just haven’t had a chance to try it out yet.

I’ve used “{NSRect}” for various functions as arguments and return values.