Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Last active February 6, 2016 02:52
Show Gist options
  • Save KentarouKanno/119178f22bf2b66a8603 to your computer and use it in GitHub Desktop.
Save KentarouKanno/119178f22bf2b66a8603 to your computer and use it in GitHub Desktop.
StringInterpolationConvertible

StringInterpolationConvertible

let str = "\(1)"
//=> "1"

let value = [1, 2, 3]

let str = "\(value)"
//=> "[1, 2, 3]"

let str = "\(value.count)"
//=> "3"

let str = "\(value.contains(2))"
//=> "true"

let str = "\(value.count)"
//=> "3"

let str = "\(value.map { $0 * 2 } .reduce (0, combine: +))"
//=> "12"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment