Show HN: Cheatcode.io, a Swift syntax reference
cheatcode.io
cheatcode.io
A simple solution:
? -> Optionals
?? -> nil coalescing
! -> Implicitly Unwrapped Optionals
<> -> Generics
as? -> type casting
…and so onA Better solution:
provide a wikipedia-like disambiguation section for special characters (since `!` could be Implicitly unwrapped optionals, Forced unwrapping, or boolean negation)
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.