3 ms·
Show HN: Cheatcode.io, a Swift syntax reference
- jiaaro 12y agoSearches for unfamiliar special characters should work. Single-character operators and syntactic sugar are one of the harder things to google for, and consequently, a big advantage of a purpose made language reference tool like you've made. A simple solution: ? -> Optionals ?? -> nil coalescing ! -> Implicitly Unwrapped Optionals <> -> Generics as? -> type casting …and so on A Better solution: provide a wikipedia-like disambiguation section for special characters (since `!` could be Implicitly unwrapped optionals, Forced unwrapping, or boolean negation)
- paulshen 12y agoThanks for the feedback! I definitely agree. I've added support for the symbols you suggested (and a couple more, like & for passing inout arguments). How I implemented this was writing YAML files that get compiled. Each entry has a name, an array of strings for tags, and the code sample itself. When you type a query, it shows prefix tag matches first, followed by non-prefix tag matches. So now when you type '?', you should see optionals, ternary, nil coalescing, etc.. but when you type '??', you're left with only nil coalescing.