<div dir="ltr"><div>&gt; In the case where your input is hashable, you could just do:</div><div>&gt; </div><div>&gt; let i = [.Red:0xff0000, .Green:0x00ff00, .Blue:0x0000ff][color]</div><div><br></div><div>Mea culpa: you were correct, this actually *does* work in a Playground, as long as you access it when you construct it. </div><div><br></div><div>I didn&#39;t realize Swift was smart enough to infer a one-off Dict by its key. Thanks Lattner &amp; co! That is extremely cool :)</div><div><br></div><div>So that just leaves the fact that the Keys need to be hashable / not optional.</div><div><br></div><div><br></div><div><br></div></div>