Xcode, ObjC, properties and linker

Either I am going crazy or Xcode behaves at least very different from the previous versions.

Checked with Xcode 12.2 and 12.3 beta.

Issue 1

You can do something like this without @implementation

Code Block
@interface Bar : NSObject
- (void)foo;
@end


and project compiles


Issue 2 (or part of issue 1).

Foo is just an empty object with one no-op method -(void)bar.
Foo.m is not included in compiled sources.

Code Block
#import "ViewController.h"
#import "Foo.h"
@interface ViewController ()
@property (nonatomic, strong) Foo *fooProperty;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
/**
Issue #2 (or maybe 1 part deux)
The star of the show is Foo *fooProperty.
Foo.m is not included in compiled sources.
But for some reason, there is no mention of it during the linking stage.
Uncomment next two lines and compilation fails
Foo *fooInstance = [Foo new];
[fooInstance bar];
Or you can uncomment this
self.fooProperty = [Foo new];
**/
[self.fooProperty bar];
}



Well, you did give me two options there...

Objective-C is a very dynamic language. It can exhibit strange behaviours. I strongly urge you not to ship any software that depends on any of those strange behaviours.
Xcode, ObjC, properties and linker
 
 
Q