Created
January 14, 2020 08:43
-
-
Save backslash-f/269998060f9468d57a533b50a4b26613 to your computer and use it in GitHub Desktop.
typealias + Function with return value
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 SwiftUI | |
typealias Filter = (CGImage) -> CGImage | |
func blur(radius: Double) -> Filter { | |
return { image in | |
// Do something. | |
return image | |
} | |
} | |
let url = Bundle.main.url(forResource: "Landscape/Landscape_0", withExtension: "jpg")! | |
SImage().createImage(from: url) { cgImage in | |
if let image = cgImage { | |
let sameImage = blur(radius: 2.0)(image) // 👈🏻 | |
sameImage | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment