Created
July 24, 2019 20:05
-
-
Save mike3k/c07d0204df2ff23d70ef97ab0ab935cf to your computer and use it in GitHub Desktop.
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
protocol ImageProviderProtocol { | |
func image() -> UIImage? | |
} | |
class ImageProvider { | |
extension ImageProvider: ImageProviderProtocol { | |
func image() -> UIImage? { | |
return nil | |
} | |
} | |
class SomeOtherClass { | |
let imageProvider: ImageProviderProtocol | |
func returnImage -> UIImage { | |
return imageProvider.image() // <- shouldn't this give an error? | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment