Skip to content

Instantly share code, notes, and snippets.

@ezura
Created September 7, 2017 13:44
Show Gist options
  • Save ezura/7e7eb8df0034781465d103ea88a1da8e to your computer and use it in GitHub Desktop.
Save ezura/7e7eb8df0034781465d103ea88a1da8e to your computer and use it in GitHub Desktop.
うっかりOptinalを文字列に変換してしまい、"Optinal("こんにちは")" みたいな文字列になってしまうやつをやっつけてみた( 'ω') #CodePiece
"\(Normal() as Optional)"
// -> "Optional(description)"
"\(Force() as Optional)"
// -> "description"
// ------------------
struct Normal: CustomStringConvertible {
var description: String { return "\(#function)" }
}
struct Force: CustomForce💪StringConvertible {
var description: String { return "\(#function)" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment