groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
597 stars 155 forks source link

Fix problem where some constructors in Template could block the main thread #101

Closed fumito-ito closed 3 weeks ago

fumito-ito commented 3 weeks ago

User can use constructors that pass URL when initializing a Template object. This constructor can generate a Template object from a string that exists not only locally, but also server-side.

Since this constructor calls NSString(contentsOf:encoding) internally, it could block the calling thread if the given URL is remote.

This change adds a constructor for a Template object that can be called in async for iOS 15 and above. This constructor allows remote resources to be used without blocking the calling thread.