stencilproject / Stencil

Stencil is a simple and powerful template language for Swift.
https://stencil.fuller.li
BSD 2-Clause "Simplified" License
2.34k stars 221 forks source link

Fixed accessing optional properties through reflection #204

Closed ilyapuchka closed 6 years ago

ilyapuchka commented 6 years ago

Resolves https://github.com/kylef/Stencil/pull/110#issuecomment-375998844 When getting descendant that represents optional property casting it to Optional will just wrap it in another optional, so instead we use a custom protocol that only Optional implements and that provides unwrapped value or returns nil. If property is not optional we will just return its value.

djbe commented 6 years ago

That was quick 👍

djbe commented 6 years ago

I've tested it locally and can confirm this fixes the issue 🎉