Created
March 7, 2017 16:25
-
-
Save morishin/4bc055923617694e3b1f3b26d4bccb9d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Foundation | |
import Runes | |
struct Recipe { | |
let imageURLString: String? | |
} | |
let recipe = Recipe(imageURLString: "http://hoge/image.png") | |
// default | |
if let imageURLString = recipe.imageURLString, let imageURL = URL(string: imageURLString) { | |
print(imageURL) | |
} | |
// with Runes | |
if let imageURL = recipe.imageURLString >>- { URL(string: $0) } { | |
print(imageURL) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment