Created
September 7, 2017 13:44
-
-
Save ezura/7e7eb8df0034781465d103ea88a1da8e to your computer and use it in GitHub Desktop.
うっかりOptinalを文字列に変換してしまい、"Optinal("こんにちは")" みたいな文字列になってしまうやつをやっつけてみた( 'ω') #CodePiece
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"\(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