Hacker News new | past | comments | ask | show | jobs | submit login
Publish – A static site generator for Swift developers (github.com/johnsundell)
143 points by _quhg on Dec 30, 2019 | hide | past | favorite | 20 comments



John Sundell is awesome. Other stuff he’s done:

Plot: Write type safe HTML/RSS/XML in Swift https://github.com/JohnSundell/Plot

Ink: Converts markdown to HTML https://github.com/JohnSundell/Ink

Swift by Sundell blog https://www.swiftbysundell.com/

Podcast https://www.swiftbysundell.com/podcast

I really love these lightweight, JavaScript free websites he’s helping create in Swift. It’s such a better experience loading and reading than other blogs - the inlined sponsor/ads even look nice and don’t feel overwhelming or annoying (I usually read them!).


Yeah the sponsor ads are great. They're hyper focused on my interest while they know nothing about me when I visit the website. Golly I wish how they would do it! Sometimes I get to know iOS development related products that I didn't know about but should have. Think they had about the same click-through rate as all of the other banners I've seen last year combined.

On the other hand Google seems to think I need a Foreverspin after carefully analyzing all of my click behavior over thousands of websites.


Great to see Swift being used outside of macOS/iOS.

Is this increasingly common?

Is it worth learning and adopting Swift as an alternative to Rust/Go/Dart, for example? It feels like it could be a strong general purpose language.

It seems a shame to restrict the language to Apple's ecosystem only. Apple's own docs make it sound like use cases outside of the Apple ecosystem are being left to the community; that Apple does not have any intention to make the language have broader appeal itself: https://developer.apple.com/swift/#xplatform


I believe it's a capable language and I hope to use it more like that in the future.

Right now there are things like:

-vapor: https://vapor.codes/ to do server things

-tensorflow swift: https://www.tensorflow.org/swift for machine learning at a lower level than python, meant to replace a lot of the work that ends up being done in c++

One of the biggest problems is that it isn't as cross platform as we want it to be yet (it kinda works on windows now: https://swiftforwindows.github.io/ - but not for 5.0 yet), some of the more recent changes to the language are setting it up to be more cross platform as well, but I've forgotten the specific term. Also a lot of libraries on linux don't work quite the same as MacOS or are incomplete/missing. The biggest hold-back though that and the public opinion seems to be that swift == IOS dev.

The only way I can think to change that opinion is to build something incredible first and then let everyone react with "you can do that? I didn't think you could do that, wow".


I was listening to a podcast with Jeremy Howard (of fast.ai) where he was talking about Swift as a language increasingly popular for deep learning. Here's a blog post where he writes about why: https://www.fast.ai/2019/03/06/fastai-swift/


What's a good data type for text with hyperlinks?


A tree?


Since hyperlinks can link to any document, not just children, shouldn't the data structure be a (not necessarily tree-shaped) directed graph?


I can't even decide whether the text (e.g. in a div or p element) should be stored as a unit with links stored as meta-data, or should the stretches of text before/after/between links be "chunks" and the links store their own content (like DOM)?

It's an old question, see the "piece-chain" structure Prof With chose for text-with-"looks" (aka "style") http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.Syste... section 5.2, "Text Management".


The former is how NSAttributedString works in the Apple ecosystem. It’s a plain string with attributes attached to certain character ranges.

https://developer.apple.com/documentation/foundation/nsattri...


Like this idea in theory.

The author's site (built with Publish) seems slow to me. Cause unknown. Would like to see more examples.

https://swiftbysundell.com/


It's fast. It's static. CDN as mentioned. Nothing impressive here though. This wheel has been done.


By?


Lighthouse gives it a 99 and the footer says that the site is “100% JavaScript free”. Did you mean runtime performance?


It's not slow by any stretch of the word compared to the rest of the web.

A clean reload transfers only 300kb of data that uncompresses to 670kb. Of that 223kb(570kb uncompressed) are fonts which are heavily cached and change rarely if ever. DOMContentLoaded fires after 80ms.

Subsequent loads are completely cached.

In an age where the average website is multi megabyte https://swiftbysundell.com/ is a refreshing and excellent demonstration of how good the web can be.


The site is being served directly by CloudFlare's CDN, hard to make it much faster than that.


It seems slow because the content isn't loaded yet. The first visit is faster, each subsequent click takes longer.

That is good for blogs, news and similar because you rarely go through several pages, but horrible for webapps where you spend a lot of time switching between content


It's very fast for me. (~200ms from request start to first contentful paint)


Actually it’s quite fast for me compared to “modern” sites.


How did you measure its performance?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: