Instantly share code, notes, and snippets.

Embed
What would you like to do?
private func loadTemplate(ofType type: TemplateType) -> String?
{
guard let template_url = Bundle(for: ReportEngine.self).url(forResource: type.rawValue, withExtension: "html"),
let template_data = try? Data(contentsOf: template_url),
let template = String(data: template_data, encoding: .utf8)
else
{
return nil
}
return template as String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment