I've got a .h file set up just like in the Metal Xcode template (I copy and pasted the relevant content from one of those files into another existing project not made from the template), but when I define a struct in there similar to how it's defined in the template, my Swift code isn't finding the definition - so the compiler says the struct type doesn't exist. The shaders seem to be fine since I've got the #include statement for the shared .h file in the shader file, so it's just the Swift code that seems to have an issue. Any suggestions on how to fix this? Below is a sample of what I tried.
#ifndef ShaderTypes_h
#define ShaderTypes_h
#ifdef __METAL_VERSION__
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
#define NSInteger metal::int32_t
#else
#import <Foundation/Foundation.h>
#endif
#include <simd/simd.h>
typedef struct {
int test;
} Test;
#endif /* ShaderTypes_h */
In the Swift code I just tried defining an instance of the struct type, and then I get use of undefined type/identifier errors.