[swift-users] Generating html code, best practise?

Rien Rien at Balancingrock.nl
Fri May 19 03:09:44 CDT 2017


I want to generate some HTML code with Swift. Of course there are many way to do this, but I am not looking to do an "in-dept all options open” approach.
Just some ‘get the html out quickly” type of thing.

So I wonder, how do _you_ do this?

Simply using Strings is one option, but cumbersome and without any ‘html-type-safety’
Using some general purpose function (e.g. func tagged(tag: String, content: String) -> String) helps a little, but not very much.
Enums are another possibility.
Or var’s in a struct/class that wrap the html element etc.

Many possibilities.

Any suggestion is welcome, suggestions as wel as experiences.
Of course if there is a solution out there, I’d like to know as well. (I didn’t find any though)


Regards,
Rien

Site: http://balancingrock.nl
Blog: http://swiftrien.blogspot.com
Github: http://github.com/Balancingrock
Project: http://swiftfire.nl - A server for websites build in Swift








More information about the swift-users mailing list