Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaisukeNagata/1cfcbafeddbf8a43ccdbe3e0075da5e8 to your computer and use it in GitHub Desktop.
Save DaisukeNagata/1cfcbafeddbf8a43ccdbe3e0075da5e8 to your computer and use it in GitHub Desktop.
Swift_Syntactic Sugar
let dic = [Dictionary<String, String>.Element]() // Not Syntactic Sugar
let dic = [(key: "", value: "")] // Syntactic Sugar
@DaisukeNagata
Copy link
Author

let dic = [sugarDic("", "")]

func sugarDic<K, V>(_ key: K, _ value: V) -> (key: K, value: V) {
    return (key: key, value: value)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment