

Show HN: Cheatcode.io, a Swift syntax reference - paulshen
http://cheatcode.io/

======
jiaaro
Searches 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
Thanks 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.

