69 lines
1.9 KiB
Plaintext
69 lines
1.9 KiB
Plaintext
|
// Generated using SwiftGen — https://github.com/SwiftGen/SwiftGen
|
||
|
|
||
|
{% if tables.count > 0 %}
|
||
|
#import <Foundation/Foundation.h>
|
||
|
|
||
|
NS_ASSUME_NONNULL_BEGIN
|
||
|
|
||
|
{% macro parametersBlock types %}{% filter removeNewlines:"leading" %}
|
||
|
{% for type in types %}
|
||
|
({% call paramTranslate type %})p{{ forloop.counter }}{{ " :" if not forloop.last }}
|
||
|
{% endfor %}
|
||
|
{% endfilter %}{% endmacro %}
|
||
|
{% macro argumentsBlock types %}{% filter removeNewlines:"leading" %}
|
||
|
{% for type in types %}
|
||
|
p{{forloop.counter}}{{ ", " if not forloop.last }}
|
||
|
{% endfor %}
|
||
|
{% endfilter %}{% endmacro %}
|
||
|
{% macro paramTranslate swiftType %}
|
||
|
{% if swiftType == "Any" %}
|
||
|
id
|
||
|
{% elif swiftType == "CChar" %}
|
||
|
char
|
||
|
{% elif swiftType == "Float" %}
|
||
|
float
|
||
|
{% elif swiftType == "Int" %}
|
||
|
NSInteger
|
||
|
{% elif swiftType == "String" %}
|
||
|
id
|
||
|
{% elif swiftType == "UnsafePointer<CChar>" %}
|
||
|
char*
|
||
|
{% elif swiftType == "UnsafeRawPointer" %}
|
||
|
void*
|
||
|
{% else %}
|
||
|
objc-h.stencil is missing '{{swiftType}}'
|
||
|
{% endif %}
|
||
|
{% endmacro %}
|
||
|
{% macro emitOneMethod table item %}
|
||
|
{% for string in item.strings %}
|
||
|
{% if not param.noComments %}
|
||
|
{% for line in string.translation|split:"\n" %}
|
||
|
/// {{line}}
|
||
|
{% endfor %}
|
||
|
{% endif %}
|
||
|
{% if string.types %}
|
||
|
{% if string.types.count == 1 %}
|
||
|
+ (NSString*){{string.key|swiftIdentifier:"pretty"|lowerFirstWord}}WithValue:{% call parametersBlock string.types %};
|
||
|
{% else %}
|
||
|
+ (NSString*){{string.key|swiftIdentifier:"pretty"|lowerFirstWord}}WithValues:{% call parametersBlock string.types %};
|
||
|
{% endif %}
|
||
|
{% else %}
|
||
|
+ (NSString*){{string.key|swiftIdentifier:"pretty"|lowerFirstWord}};
|
||
|
{% endif %}
|
||
|
{% endfor %}
|
||
|
{% for child in item.children %}
|
||
|
{% call emitOneMethod table child %}
|
||
|
{% endfor %}
|
||
|
{% endmacro %}
|
||
|
{% for table in tables %}
|
||
|
@interface {{ table.name }} : NSObject
|
||
|
{% call emitOneMethod table.name table.levels %}
|
||
|
@end
|
||
|
|
||
|
{% endfor %}
|
||
|
|
||
|
NS_ASSUME_NONNULL_END
|
||
|
{% else %}
|
||
|
// No strings found
|
||
|
{% endif %}
|