Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions StencilPlugin/Model/TemplateConfig.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ + (NSOrderedSet *)objcMapsFromFileAtPath:(NSString *)filePath

+ (NSOrderedSet *)swiftMapsFromFileAtPath:(NSString *)filePath
{
NSString *objcPrefix = @"(?:@objc(?:\\s*\\(\\s*\\w+\\s*\\))?)?";
NSString *accessPrefix = @"(?:public|private|internal)?";

NSMutableOrderedSet *maps = [NSMutableOrderedSet new];
[self processFileAtPath:filePath matching:@"^\\s*extension\\s+(\\w+).*" thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:@"^\\s*class\\s+(\\w+).*" thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:@"^\\s*class\\s+(\\w+)\\s*:\\s*(\\w+).*" thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:@"^\\s*protocol\\s+(\\w+)\\s*:\\s*(\\w+).*" thingType:STCThingTypeSwiftProtocol maps:maps];
[self processFileAtPath:filePath matching:[NSString stringWithFormat:@"^\\s*%@\\s*%@\\s*extension\\s+(\\w+).*", objcPrefix, accessPrefix] thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:[NSString stringWithFormat:@"^\\s*%@\\s*%@\\s*class\\s+(\\w+).*", objcPrefix, accessPrefix] thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:[NSString stringWithFormat:@"^\\s*%@\\s*%@\\s*class\\s+(\\w+)\\s*:\\s*(\\w+).*", objcPrefix, accessPrefix] thingType:STCThingTypeSwiftClass maps:maps];
[self processFileAtPath:filePath matching:[NSString stringWithFormat:@"^\\s*%@\\s*%@\\s*protocol\\s+(\\w+)\\s*:\\s*(\\w+).*", objcPrefix, accessPrefix] thingType:STCThingTypeSwiftProtocol maps:maps];
return maps.copy;
}

Expand Down